|
| 1 | +"""project and folder trash columns |
| 2 | +
|
| 3 | +Revision ID: 5ad02358751a |
| 4 | +Revises: fce5d231e16d |
| 5 | +Create Date: 2024-11-07 17:14:01.094583+00:00 |
| 6 | +
|
| 7 | +""" |
| 8 | +import sqlalchemy as sa |
| 9 | +from alembic import op |
| 10 | +from sqlalchemy.dialects import postgresql |
| 11 | + |
| 12 | +# revision identifiers, used by Alembic. |
| 13 | +revision = "5ad02358751a" |
| 14 | +down_revision = "fce5d231e16d" |
| 15 | +branch_labels = None |
| 16 | +depends_on = None |
| 17 | + |
| 18 | + |
| 19 | +def upgrade(): |
| 20 | + # ### commands auto generated by Alembic - please adjust! ### |
| 21 | + op.add_column( |
| 22 | + "folders_v2", |
| 23 | + sa.Column( |
| 24 | + "trashed_at", |
| 25 | + sa.DateTime(timezone=True), |
| 26 | + nullable=True, |
| 27 | + comment="The date and time when the folder was marked as trashed.Null if the folder has not been trashed [default].", |
| 28 | + ), |
| 29 | + ) |
| 30 | + op.add_column( |
| 31 | + "folders_v2", |
| 32 | + sa.Column( |
| 33 | + "trashed_explicitly", |
| 34 | + sa.Boolean(), |
| 35 | + server_default=sa.text("false"), |
| 36 | + nullable=False, |
| 37 | + comment="Indicates whether the folder was explicitly trashed by the user (true) or inherited its trashed status from a parent (false) [default].", |
| 38 | + ), |
| 39 | + ) |
| 40 | + op.add_column( |
| 41 | + "projects", |
| 42 | + sa.Column( |
| 43 | + "trashed_explicitly", |
| 44 | + sa.Boolean(), |
| 45 | + server_default=sa.text("false"), |
| 46 | + nullable=False, |
| 47 | + comment="Indicates whether the project was explicitly trashed by the user (true) or inherited its trashed status from a parent (false) [default].", |
| 48 | + ), |
| 49 | + ) |
| 50 | + op.alter_column( |
| 51 | + "projects", |
| 52 | + "trashed_at", |
| 53 | + existing_type=postgresql.TIMESTAMP(timezone=True), |
| 54 | + comment="The date and time when the project was marked as trashed. Null if the project has not been trashed [default].", |
| 55 | + existing_nullable=True, |
| 56 | + ) |
| 57 | + # ### end Alembic commands ### |
| 58 | + |
| 59 | + |
| 60 | +def downgrade(): |
| 61 | + # ### commands auto generated by Alembic - please adjust! ### |
| 62 | + op.alter_column( |
| 63 | + "projects", |
| 64 | + "trashed_at", |
| 65 | + existing_type=postgresql.TIMESTAMP(timezone=True), |
| 66 | + comment=None, |
| 67 | + existing_comment="The date and time when the project was marked as trashed. Null if the project has not been trashed [default].", |
| 68 | + existing_nullable=True, |
| 69 | + ) |
| 70 | + op.drop_column("projects", "trashed_explicitly") |
| 71 | + op.drop_column("folders_v2", "trashed_explicitly") |
| 72 | + op.drop_column("folders_v2", "trashed_at") |
| 73 | + # ### end Alembic commands ### |
0 commit comments