Skip to content

Commit

Permalink
feat: add one-one relationship between user and cart table
Browse files Browse the repository at this point in the history
  • Loading branch information
Flora2020 committed Aug 26, 2021
1 parent c1ea786 commit 77a3e98
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""add one-one relationship between cart and user table
Revision ID: 5b69bc8db7e7
Revises: cd6dce4eb1ee
Create Date: 2021-08-26 16:20:18.947078
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '5b69bc8db7e7'
down_revision = 'cd6dce4eb1ee'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('cart', sa.Column('user_id', sa.Integer(), nullable=True))
op.create_foreign_key('cart_ibfk_1', 'cart', 'user', ['user_id'], ['id'])
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('cart_ibfk_1', 'cart', type_='foreignkey')
op.drop_column('cart', 'user_id')
# ### end Alembic commands ###

0 comments on commit 77a3e98

Please sign in to comment.