Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Maintenance: removing old folders #6383

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ###

This file was deleted.

Loading
Loading