You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.7 KiB
Python
54 lines
1.7 KiB
Python
"""empty message
|
|
|
|
Revision ID: d76ecaeb13db
|
|
Revises:
|
|
Create Date: 2023-09-20 15:18:51.616651
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = 'd76ecaeb13db'
|
|
down_revision: Union[str, None] = None
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
'user',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('username', sa.String(length=30), nullable=False),
|
|
sa.Column('primary_email', sa.String(length=120), nullable=False),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('primary_email'),
|
|
sa.UniqueConstraint('username'),
|
|
)
|
|
op.create_table(
|
|
'contact',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('user_id', sa.Integer(), nullable=False),
|
|
sa.Column('first_name', sa.String(length=30), nullable=False),
|
|
sa.Column('last_name', sa.String(length=30), nullable=False),
|
|
sa.Column('phone_contents', sa.String(length=30), nullable=False),
|
|
sa.Column('email', sa.String(length=120), nullable=False),
|
|
sa.ForeignKeyConstraint(
|
|
['user_id'],
|
|
['user.id'],
|
|
),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('email'),
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('contact')
|
|
op.drop_table('user')
|
|
# ### end Alembic commands ###
|