Skip to content

Commit f0cb96b

Browse files
committed
Try fixing migrations 5: remove pricetype error
1 parent 3fefa5e commit f0cb96b

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

migrations/versions/eb948c31a342_create_gear_table.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
"""
88
from alembic import op
99
import sqlalchemy as sa
10-
11-
# Import the PriceType enum used in the model so the Enum can be created
12-
from src.models.activity import PriceType
10+
from sqlalchemy.dialects import postgresql
1311

1412

1513
# revision identifiers, used by Alembic.
@@ -18,6 +16,9 @@
1816
branch_labels = None
1917
depends_on = None
2018

19+
### Ensures alembic does not try to create enum
20+
price_type_enum = postgresql.ENUM('rate', 'gear', name='pricetype', create_type=False)
21+
2122

2223
def upgrade():
2324
op.create_table(
@@ -27,7 +28,7 @@ def upgrade():
2728
sa.Column("name", sa.String(), nullable=False),
2829
sa.Column("cost", sa.Float(), nullable=False),
2930
sa.Column("rate", sa.String(), nullable=True),
30-
sa.Column("type", sa.Enum(PriceType, create_type=False), nullable=False),
31+
sa.Column("type", price_type_enum, nullable=False),
3132
)
3233

3334
def downgrade():

0 commit comments

Comments
 (0)