Skip to content

Commit df5dd8f

Browse files
committed
new cols
1 parent 67a49b3 commit df5dd8f

File tree

4 files changed

+88
-44
lines changed

4 files changed

+88
-44
lines changed

packages/postgres-database/src/simcore_postgres_database/migration/versions/17eea8ba5d4f_new_trashed_colums.py

Lines changed: 0 additions & 39 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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 ###

packages/postgres-database/src/simcore_postgres_database/models/folders_v2.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,15 @@
7979
"trashed_at",
8080
sa.DateTime(timezone=True),
8181
nullable=True,
82-
doc="The date and time when the folder was marked as trashed. Null if the folder has not been trashed.",
82+
comment="The date and time when the folder was marked as trashed."
83+
"Null if the folder has not been trashed [default].",
8384
),
8485
sa.Column(
8586
"trashed_explicitly",
8687
sa.Boolean,
8788
nullable=False,
8889
server_default=expression.false(),
89-
doc="Indicates whether the folder was explicitly trashed by the user (true) or inherited its trashed status from a parent (false).",
90+
comment="Indicates whether the folder was explicitly trashed by the user (true)"
91+
" or inherited its trashed status from a parent (false) [default].",
9092
),
9193
)

packages/postgres-database/src/simcore_postgres_database/models/projects.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import sqlalchemy as sa
77
from sqlalchemy.dialects.postgresql import ARRAY, JSONB
8-
from sqlalchemy.sql import func
8+
from sqlalchemy.sql import expression, func
99

1010
from .base import metadata
1111

@@ -145,8 +145,16 @@ class ProjectType(enum.Enum):
145145
"trashed_at",
146146
sa.DateTime(timezone=True),
147147
nullable=True,
148-
doc="The date and time when the project was marked as trashed. Null if the project has not been trashed."
149-
"When a project is implicitly trashed (e.g. a parent is trashed) then it also has hidden=True",
148+
comment="The date and time when the project was marked as trashed. "
149+
"Null if the project has not been trashed [default].",
150+
),
151+
sa.Column(
152+
"trashed_explicitly",
153+
sa.Boolean,
154+
nullable=False,
155+
server_default=expression.false(),
156+
comment="Indicates whether the project was explicitly trashed by the user (true)"
157+
" or inherited its trashed status from a parent (false) [default].",
150158
),
151159
sa.Column(
152160
"workspace_id",

0 commit comments

Comments
 (0)