diff options
author | Rasmus Luha <rasmus.luha@gmail.com> | 2022-02-24 02:57:29 +0200 |
---|---|---|
committer | Rasmus Luha <rasmus.luha@gmail.com> | 2022-02-24 02:57:29 +0200 |
commit | 3ce694bbebb9c24606e83f8923ca8055b7c9c63d (patch) | |
tree | 79bdc75a28eadabb18fb65978f0dec914eea546d /alembic/versions/f60bfe68b20f_add_other_posts_columns.py | |
parent | f1ab105a7620160c16d7c91bdf3ca1cff6deef7c (diff) |
Added Alembic stuff
Diffstat (limited to 'alembic/versions/f60bfe68b20f_add_other_posts_columns.py')
-rw-r--r-- | alembic/versions/f60bfe68b20f_add_other_posts_columns.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/alembic/versions/f60bfe68b20f_add_other_posts_columns.py b/alembic/versions/f60bfe68b20f_add_other_posts_columns.py new file mode 100644 index 0000000..0f2c369 --- /dev/null +++ b/alembic/versions/f60bfe68b20f_add_other_posts_columns.py @@ -0,0 +1,30 @@ +"""add other posts columns + +Revision ID: f60bfe68b20f +Revises: e68b0c5f7380 +Create Date: 2022-02-24 02:26:37.946997 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'f60bfe68b20f' +down_revision = 'e68b0c5f7380' +branch_labels = None +depends_on = None + + +def upgrade(): + op.add_column("posts", sa.Column("published", sa.Boolean(), nullable=False, + server_default="TRUE"),) + op.add_column("posts", sa.Column("created_at", sa.TIMESTAMP(timezone=True), nullable=False, + server_default=sa.text("NOW()")),) + pass + + +def downgrade(): + op.drop_column("posts", "published") + op.drop_column("posts", "created_at") + pass |