This commit is contained in:
2025-08-23 16:22:46 -04:00
parent 0c50b05324
commit 3e02ef57b9
9 changed files with 196 additions and 18 deletions

View File

@ -0,0 +1,11 @@
-- Migration: 003_add_token_prefix (down)
-- Remove token prefix field from applications table
-- Drop constraint first
ALTER TABLE applications DROP CONSTRAINT IF EXISTS chk_token_prefix_format;
-- Drop index
DROP INDEX IF EXISTS idx_applications_token_prefix;
-- Drop the prefix column
ALTER TABLE applications DROP COLUMN IF EXISTS token_prefix;

View File

@ -0,0 +1,15 @@
-- Migration: 003_add_token_prefix
-- Add token prefix field to applications table
-- Add prefix field to applications table
ALTER TABLE applications ADD COLUMN token_prefix VARCHAR(10) DEFAULT '' NOT NULL;
-- Add check constraint to ensure prefix is 2-4 uppercase letters
ALTER TABLE applications ADD CONSTRAINT chk_token_prefix_format
CHECK (token_prefix ~ '^[A-Z]{2,4}$' OR token_prefix = '');
-- Create index for prefix field
CREATE INDEX idx_applications_token_prefix ON applications(token_prefix);
-- Update existing applications with empty prefix (they will use the default "kms_" prefix)
-- Applications can later be updated to have custom prefixes