-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Maintenance: removing old folders (#6383)
- Loading branch information
1 parent
24dc16e
commit 65ffdd9
Showing
5 changed files
with
171 additions
and
3,652 deletions.
There are no files selected for viewing
169 changes: 169 additions & 0 deletions
169
...abase/src/simcore_postgres_database/migration/versions/47ca7335e146_remove_old_folders.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
"""remove old folders | ||
Revision ID: 47ca7335e146 | ||
Revises: 9f381dcb9b95 | ||
Create Date: 2024-09-17 11:54:39.600025+00:00 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "47ca7335e146" | ||
down_revision = "9f381dcb9b95" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table("folders_to_projects") | ||
op.drop_table("folders_access_rights") | ||
op.drop_table("folders") | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"folders", | ||
sa.Column( | ||
"id", | ||
sa.BIGINT(), | ||
server_default=sa.text("nextval('folders_id_seq'::regclass)"), | ||
autoincrement=True, | ||
nullable=False, | ||
), | ||
sa.Column("name", sa.VARCHAR(), autoincrement=False, nullable=False), | ||
sa.Column( | ||
"description", | ||
sa.VARCHAR(), | ||
server_default=sa.text("''::character varying"), | ||
autoincrement=False, | ||
nullable=False, | ||
), | ||
sa.Column("created_by", sa.BIGINT(), autoincrement=False, nullable=True), | ||
sa.Column( | ||
"created", | ||
postgresql.TIMESTAMP(timezone=True), | ||
server_default=sa.text("now()"), | ||
autoincrement=False, | ||
nullable=False, | ||
), | ||
sa.Column( | ||
"modified", | ||
postgresql.TIMESTAMP(timezone=True), | ||
server_default=sa.text("now()"), | ||
autoincrement=False, | ||
nullable=False, | ||
), | ||
sa.Column("product_name", sa.VARCHAR(), autoincrement=False, nullable=False), | ||
sa.ForeignKeyConstraint( | ||
["created_by"], | ||
["groups.gid"], | ||
name="fk_folders_to_groups_gid", | ||
ondelete="SET NULL", | ||
), | ||
sa.ForeignKeyConstraint( | ||
["product_name"], | ||
["products.name"], | ||
name="fk_folders_to_products_name", | ||
onupdate="CASCADE", | ||
ondelete="CASCADE", | ||
), | ||
sa.PrimaryKeyConstraint("id", name="folders_pkey"), | ||
postgresql_ignore_search_path=False, | ||
) | ||
op.create_table( | ||
"folders_access_rights", | ||
sa.Column("folder_id", sa.BIGINT(), autoincrement=False, nullable=False), | ||
sa.Column("gid", sa.BIGINT(), autoincrement=False, nullable=False), | ||
sa.Column( | ||
"traversal_parent_id", sa.BIGINT(), autoincrement=False, nullable=True | ||
), | ||
sa.Column( | ||
"original_parent_id", sa.BIGINT(), autoincrement=False, nullable=True | ||
), | ||
sa.Column("read", sa.BOOLEAN(), autoincrement=False, nullable=False), | ||
sa.Column("write", sa.BOOLEAN(), autoincrement=False, nullable=False), | ||
sa.Column("delete", sa.BOOLEAN(), autoincrement=False, nullable=False), | ||
sa.Column( | ||
"created", | ||
postgresql.TIMESTAMP(timezone=True), | ||
server_default=sa.text("now()"), | ||
autoincrement=False, | ||
nullable=False, | ||
), | ||
sa.Column( | ||
"modified", | ||
postgresql.TIMESTAMP(timezone=True), | ||
server_default=sa.text("now()"), | ||
autoincrement=False, | ||
nullable=False, | ||
), | ||
sa.ForeignKeyConstraint( | ||
["folder_id"], | ||
["folders.id"], | ||
name="fk_folders_access_rights_to_folders_id", | ||
onupdate="CASCADE", | ||
ondelete="CASCADE", | ||
), | ||
sa.ForeignKeyConstraint( | ||
["gid"], | ||
["groups.gid"], | ||
name="fk_folders_access_rights_to_groups_gid", | ||
onupdate="CASCADE", | ||
ondelete="CASCADE", | ||
), | ||
sa.ForeignKeyConstraint( | ||
["original_parent_id"], | ||
["folders.id"], | ||
name="fk_folders_to_folders_id_via_original_parent_id", | ||
ondelete="SET NULL", | ||
), | ||
sa.ForeignKeyConstraint( | ||
["traversal_parent_id"], | ||
["folders.id"], | ||
name="fk_folders_to_folders_id_via_traversal_parent_id", | ||
ondelete="SET NULL", | ||
), | ||
sa.PrimaryKeyConstraint("folder_id", "gid", name="folders_access_rights_pk"), | ||
) | ||
op.create_table( | ||
"folders_to_projects", | ||
sa.Column("folder_id", sa.BIGINT(), autoincrement=False, nullable=False), | ||
sa.Column("project_uuid", sa.VARCHAR(), autoincrement=False, nullable=False), | ||
sa.Column( | ||
"created", | ||
postgresql.TIMESTAMP(timezone=True), | ||
server_default=sa.text("now()"), | ||
autoincrement=False, | ||
nullable=False, | ||
), | ||
sa.Column( | ||
"modified", | ||
postgresql.TIMESTAMP(timezone=True), | ||
server_default=sa.text("now()"), | ||
autoincrement=False, | ||
nullable=False, | ||
), | ||
sa.ForeignKeyConstraint( | ||
["folder_id"], | ||
["folders.id"], | ||
name="fk_folders_to_projects_to_folders_id", | ||
onupdate="CASCADE", | ||
ondelete="CASCADE", | ||
), | ||
sa.ForeignKeyConstraint( | ||
["project_uuid"], | ||
["projects.uuid"], | ||
name="fk_folders_to_projects_to_projects_uuid", | ||
onupdate="CASCADE", | ||
ondelete="CASCADE", | ||
), | ||
sa.PrimaryKeyConstraint( | ||
"folder_id", "project_uuid", name="projects_to_folder_pk" | ||
), | ||
) | ||
# ### end Alembic commands ### |
183 changes: 0 additions & 183 deletions
183
packages/postgres-database/src/simcore_postgres_database/models/folders.py
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.