Spaces:
Sleeping
Sleeping
axeronis commited on
Commit ·
0e26c38
1
Parent(s): d9609d0
Add Alembic migration for new psychotype enum values (analytical, driven, emotional, harmonic)
Browse files
backend/alembic/versions/2026_01_26_add_psychotype_enums.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Add new psychotype enum values for extended DISC classification.
|
| 2 |
+
|
| 3 |
+
Revision ID: add_psychotype_enums
|
| 4 |
+
Revises: 2026_01_24_granular_notifications
|
| 5 |
+
Create Date: 2026-01-26
|
| 6 |
+
"""
|
| 7 |
+
from alembic import op
|
| 8 |
+
import sqlalchemy as sa
|
| 9 |
+
|
| 10 |
+
# revision identifiers
|
| 11 |
+
revision = 'add_psychotype_enums'
|
| 12 |
+
down_revision = '2026_01_24_granular_notifications'
|
| 13 |
+
branch_labels = None
|
| 14 |
+
depends_on = None
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def upgrade():
|
| 18 |
+
"""Add new psychotype values to the PostgreSQL ENUM."""
|
| 19 |
+
# In PostgreSQL, we need to ALTER TYPE to add new enum values
|
| 20 |
+
# These must be added one by one
|
| 21 |
+
|
| 22 |
+
# Add 'analytical' value
|
| 23 |
+
op.execute("ALTER TYPE psychotype ADD VALUE IF NOT EXISTS 'analytical'")
|
| 24 |
+
|
| 25 |
+
# Add 'driven' value
|
| 26 |
+
op.execute("ALTER TYPE psychotype ADD VALUE IF NOT EXISTS 'driven'")
|
| 27 |
+
|
| 28 |
+
# Add 'emotional' value
|
| 29 |
+
op.execute("ALTER TYPE psychotype ADD VALUE IF NOT EXISTS 'emotional'")
|
| 30 |
+
|
| 31 |
+
# Add 'harmonic' value
|
| 32 |
+
op.execute("ALTER TYPE psychotype ADD VALUE IF NOT EXISTS 'harmonic'")
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def downgrade():
|
| 36 |
+
"""
|
| 37 |
+
PostgreSQL does not support removing values from ENUMs.
|
| 38 |
+
This is a one-way migration.
|
| 39 |
+
"""
|
| 40 |
+
pass
|