Skip to content

Commit

Permalink
♻️ Maintenance: removing old folders (#6383)
Browse files Browse the repository at this point in the history
  • Loading branch information
matusdrobuliak66 authored Sep 24, 2024
1 parent 24dc16e commit 65ffdd9
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 3,652 deletions.
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

0 comments on commit 65ffdd9

Please sign in to comment.