|
| 1 | +"""post model |
| 2 | +
|
| 3 | +Revision ID: 1b966e7f4b9e |
| 4 | +Revises: 198b0eebcf9 |
| 5 | +Create Date: 2013-12-31 00:00:14.700591 |
| 6 | +
|
| 7 | +""" |
| 8 | + |
| 9 | +# revision identifiers, used by Alembic. |
| 10 | +revision = '1b966e7f4b9e' |
| 11 | +down_revision = '198b0eebcf9' |
| 12 | + |
| 13 | +from alembic import op |
| 14 | +import sqlalchemy as sa |
| 15 | + |
| 16 | + |
| 17 | +def upgrade(): |
| 18 | + ### commands auto generated by Alembic - please adjust! ### |
| 19 | + op.create_table('posts', |
| 20 | + sa.Column('id', sa.Integer(), nullable=False), |
| 21 | + sa.Column('body', sa.Text(), nullable=True), |
| 22 | + sa.Column('timestamp', sa.DateTime(), nullable=True), |
| 23 | + sa.Column('author_id', sa.Integer(), nullable=True), |
| 24 | + sa.ForeignKeyConstraint(['author_id'], ['users.id'], ), |
| 25 | + sa.PrimaryKeyConstraint('id') |
| 26 | + ) |
| 27 | + op.create_index('ix_posts_timestamp', 'posts', ['timestamp'], unique=False) |
| 28 | + ### end Alembic commands ### |
| 29 | + |
| 30 | + |
| 31 | +def downgrade(): |
| 32 | + ### commands auto generated by Alembic - please adjust! ### |
| 33 | + op.drop_index('ix_posts_timestamp', 'posts') |
| 34 | + op.drop_table('posts') |
| 35 | + ### end Alembic commands ### |
0 commit comments