11"""empty message
22
3- Revision ID: cfa02231b685
3+ Revision ID: 3d224d0e6065
44Revises:
5- Create Date: 2025-12-07 16:47:32.384365
5+ Create Date: 2025-12-08 12:48:54.428901
66
77"""
88
1212from alembic import op
1313
1414# revision identifiers, used by Alembic.
15- revision : str = 'cfa02231b685 '
15+ revision : str = '3d224d0e6065 '
1616down_revision : Union [str , Sequence [str ], None ] = None
1717branch_labels : Union [str , Sequence [str ], None ] = None
1818depends_on : Union [str , Sequence [str ], None ] = None
@@ -24,6 +24,7 @@ def upgrade() -> None:
2424 op .create_table (
2525 'brands' ,
2626 sa .Column ('name' , sa .String (length = 100 ), nullable = False ),
27+ sa .Column ('slug' , sa .String (length = 200 ), nullable = False ),
2728 sa .Column ('description' , sa .String (length = 255 ), nullable = True ),
2829 sa .Column ('logo_url' , sa .String (length = 255 ), nullable = True ),
2930 sa .Column ('website_url' , sa .String (length = 255 ), nullable = True ),
@@ -43,6 +44,7 @@ def upgrade() -> None:
4344 ),
4445 sa .PrimaryKeyConstraint ('id' , name = op .f ('pk_brands' )),
4546 sa .UniqueConstraint ('name' , name = op .f ('uq_brands_name' )),
47+ sa .UniqueConstraint ('slug' , name = op .f ('uq_brands_slug' )),
4648 )
4749 op .create_table (
4850 'categories' ,
@@ -149,7 +151,7 @@ def upgrade() -> None:
149151 )
150152 op .create_index (op .f ('ix_carts_user_id' ), 'carts' , ['user_id' ], unique = True )
151153 op .create_table (
152- 'courier_profiles ' ,
154+ 'couriers ' ,
153155 sa .Column ('user_id' , sa .Integer (), nullable = False ),
154156 sa .Column (
155157 'transport_type' ,
@@ -170,10 +172,10 @@ def upgrade() -> None:
170172 nullable = False ,
171173 ),
172174 sa .ForeignKeyConstraint (
173- ['user_id' ], ['users.id' ], name = op .f ('fk_courier_profiles_user_id_users ' )
175+ ['user_id' ], ['users.id' ], name = op .f ('fk_couriers_user_id_users ' )
174176 ),
175- sa .PrimaryKeyConstraint ('id' , name = op .f ('pk_courier_profiles ' )),
176- sa .UniqueConstraint ('user_id' , name = op .f ('uq_courier_profiles_user_id ' )),
177+ sa .PrimaryKeyConstraint ('id' , name = op .f ('pk_couriers ' )),
178+ sa .UniqueConstraint ('user_id' , name = op .f ('uq_couriers_user_id ' )),
177179 )
178180 op .create_table (
179181 'delivery_addresses' ,
@@ -275,7 +277,9 @@ def upgrade() -> None:
275277 name = op .f ('fk_deliveries_address_id_delivery_addresses' ),
276278 ),
277279 sa .ForeignKeyConstraint (
278- ['courier_id' ], ['users.id' ], name = op .f ('fk_deliveries_courier_id_users' )
280+ ['courier_id' ],
281+ ['couriers.id' ],
282+ name = op .f ('fk_deliveries_courier_id_couriers' ),
279283 ),
280284 sa .ForeignKeyConstraint (
281285 ['order_id' ], ['orders.id' ], name = op .f ('fk_deliveries_order_id_orders' )
@@ -503,7 +507,7 @@ def downgrade() -> None:
503507 op .drop_index (op .f ('ix_orders_user_id' ), table_name = 'orders' )
504508 op .drop_table ('orders' )
505509 op .drop_table ('delivery_addresses' )
506- op .drop_table ('courier_profiles ' )
510+ op .drop_table ('couriers ' )
507511 op .drop_index (op .f ('ix_carts_user_id' ), table_name = 'carts' )
508512 op .drop_table ('carts' )
509513 op .drop_index (op .f ('ix_users_username' ), table_name = 'users' )
0 commit comments