diff --git a/api/migrations/versions/161cadc1af8d_add_dataset_permission_tenant_id.py b/api/migrations/versions/161cadc1af8d_add_dataset_permission_tenant_id.py index daa507a7715247..8907f781174b6b 100644 --- a/api/migrations/versions/161cadc1af8d_add_dataset_permission_tenant_id.py +++ b/api/migrations/versions/161cadc1af8d_add_dataset_permission_tenant_id.py @@ -21,31 +21,7 @@ def upgrade(): # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('dataset_permissions', schema=None) as batch_op: # Step 1: Add column without NOT NULL constraint - op.add_column('dataset_permissions', sa.Column('tenant_id', sa.UUID(), nullable=True)) - - # Step 2: Update the column to set a default value for existing rows - op.execute( - """ - UPDATE dataset_permissions - SET tenant_id = ( - SELECT tenant_id - FROM datasets - WHERE datasets.id = dataset_permissions.dataset_id - ) - """ - ) - - # Step 3: Update the column to set a default value for existing rows - op.execute( - """ - UPDATE dataset_permissions - SET tenant_id = '00000000-0000-0000-0000-000000000000' - WHERE tenant_id IS NULL - """ - ) - - # Step 4: Alter column to NOT NULL - op.alter_column('dataset_permissions', 'tenant_id', nullable=False) + op.add_column('dataset_permissions', sa.Column('tenant_id', sa.UUID(), nullable=False)) # ### end Alembic commands ###