12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- """initial_migration
- Revision ID: 476b167aef80
- Revises:
- Create Date: 2019-01-03 17:03:37.684091
- """
- from alembic import op
- import sqlalchemy as sa
- # revision identifiers, used by Alembic.
- revision = '476b167aef80'
- down_revision = None
- branch_labels = None
- depends_on = None
- def upgrade():
- op.create_table('user',
- sa.Column('id', sa.Integer(), nullable=False),
- sa.Column('name', sa.String(), nullable=False),
- sa.Column('email', sa.String(length=255), nullable=True),
- sa.Column('password', sa.String(length=255), nullable=True),
- sa.Column('registration_at', sa.DateTime(), nullable=True),
- sa.PrimaryKeyConstraint('id'),
- sa.UniqueConstraint('email'),
- sa.UniqueConstraint('name')
- )
- op.create_table('page',
- sa.Column('id', sa.Integer(), nullable=False),
- sa.Column('title', sa.String(), nullable=False),
- sa.Column('datetime', sa.DateTime(), nullable=True),
- sa.Column('source', sa.String(), nullable=True),
- sa.Column('user_id', sa.Integer(), nullable=True),
- sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
- sa.PrimaryKeyConstraint('id')
- )
- def downgrade():
- op.drop_table('page')
- op.drop_table('user')
|