You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.3 KiB
43 lines
1.3 KiB
"""Added the 'author' table.
|
|
|
|
Revision ID: 1ee62841eb90
|
|
Revises: 4594e1b85c8b
|
|
Create Date: 2019-12-11 07:25:38.054776
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '1ee62841eb90'
|
|
down_revision = '4594e1b85c8b'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('author',
|
|
sa.Column('author_id', sa.Integer(), nullable=False),
|
|
sa.Column('author_name', sa.String(length=100), nullable=False),
|
|
sa.PrimaryKeyConstraint('author_id'),
|
|
sa.UniqueConstraint('author_name')
|
|
)
|
|
op.create_table('article_author',
|
|
sa.Column('article_author_id', sa.Integer(), nullable=False),
|
|
sa.Column('seq_no', sa.Integer(), nullable=False),
|
|
sa.Column('article_id', sa.Integer(), nullable=False),
|
|
sa.Column('author_id', sa.Integer(), nullable=False),
|
|
sa.ForeignKeyConstraint(['article_id'], ['article.article_id'], ondelete='CASCADE'),
|
|
sa.ForeignKeyConstraint(['author_id'], ['author.author_id'], ondelete='CASCADE'),
|
|
sa.PrimaryKeyConstraint('article_author_id'),
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('article_author')
|
|
op.drop_table('author')
|
|
# ### end Alembic commands ###
|
|
|