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

chore(grouping): delete old grouping_records table #917

Merged
merged 8 commits into from
Jul 17, 2024
Merged
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,36 @@
"""drop old grouping_records table

Revision ID: 2597db647e9a
Revises: d87a6410efe4
Create Date: 2024-07-17 03:16:52.924194

"""

from alembic import op

# revision identifiers, used by Alembic.
revision = "2597db647e9a"
down_revision = "d87a6410efe4"
branch_labels = None
depends_on = None


def upgrade():
op.execute("ALTER TABLE IF EXISTS grouping_records RENAME to grouping_records_old;")

op.execute("ALTER TABLE grouping_records_new RENAME TO grouping_records;")
for i in range(100):
op.execute(f"ALTER TABLE grouping_records_new_p{i} RENAME TO grouping_records_p{i};")

op.execute("DROP TABLE IF EXISTS grouping_records_old")


def downgrade():
op.execute("ALTER TABLE IF EXISTS grouping_records RENAME TO grouping_records_new;")

for i in range(100):
op.execute(f"ALTER TABLE grouping_records_p{i} RENAME TO grouping_records_new_p{i};")

op.execute("ALTER TABLE grouping_records_old RENAME TO grouping_records;")

op.execute("DROP TABLE IF EXISTS grouping_records_new")
Loading