-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/extra table tracing app config (#6487)
- Loading branch information
1 parent
49ef9ef
commit 27e08a8
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
api/migrations/versions/fecff1c3da27_remove_extra_tracing_app_config_table .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,54 @@ | ||
"""remove extra tracing app config table and add idx_dataset_permissions_tenant_id | ||
Revision ID: fecff1c3da27 | ||
Revises: 408176b91ad3 | ||
Create Date: 2024-07-19 12:03:21.217463 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'fecff1c3da27' | ||
down_revision = '408176b91ad3' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table('tracing_app_configs') | ||
|
||
with op.batch_alter_table('trace_app_config', schema=None) as batch_op: | ||
batch_op.drop_index('tracing_app_config_app_id_idx') | ||
|
||
# idx_dataset_permissions_tenant_id | ||
with op.batch_alter_table('dataset_permissions', schema=None) as batch_op: | ||
batch_op.create_index('idx_dataset_permissions_tenant_id', ['tenant_id']) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
'tracing_app_configs', | ||
sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False), | ||
sa.Column('app_id', postgresql.UUID(), nullable=False), | ||
sa.Column('tracing_provider', sa.String(length=255), nullable=True), | ||
sa.Column('tracing_config', postgresql.JSON(astext_type=sa.Text()), nullable=True), | ||
sa.Column( | ||
'created_at', postgresql.TIMESTAMP(), server_default=sa.text('now()'), autoincrement=False, nullable=False | ||
), | ||
sa.Column( | ||
'updated_at', postgresql.TIMESTAMP(), server_default=sa.text('now()'), autoincrement=False, nullable=False | ||
), | ||
sa.PrimaryKeyConstraint('id', name='tracing_app_config_pkey') | ||
) | ||
|
||
with op.batch_alter_table('trace_app_config', schema=None) as batch_op: | ||
batch_op.create_index('tracing_app_config_app_id_idx', ['app_id']) | ||
|
||
with op.batch_alter_table('dataset_permissions', schema=None) as batch_op: | ||
batch_op.drop_index('idx_dataset_permissions_tenant_id') | ||
# ### end Alembic commands ### |