-
This commit is contained in:
11
migrations/003_add_token_prefix.down.sql
Normal file
11
migrations/003_add_token_prefix.down.sql
Normal 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;
|
||||
15
migrations/003_add_token_prefix.up.sql
Normal file
15
migrations/003_add_token_prefix.up.sql
Normal 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
|
||||
Reference in New Issue
Block a user