161cadc1af8d_add_dataset_permission_tenant_id.py 933 B

1234567891011121314151617181920212223242526272829303132333435
  1. """add dataset permission tenant id
  2. Revision ID: 161cadc1af8d
  3. Revises: 7e6a8693e07a
  4. Create Date: 2024-07-05 14:30:59.472593
  5. """
  6. import sqlalchemy as sa
  7. from alembic import op
  8. import models as models
  9. # revision identifiers, used by Alembic.
  10. revision = '161cadc1af8d'
  11. down_revision = '7e6a8693e07a'
  12. branch_labels = None
  13. depends_on = None
  14. def upgrade():
  15. # ### commands auto generated by Alembic - please adjust! ###
  16. with op.batch_alter_table('dataset_permissions', schema=None) as batch_op:
  17. # Step 1: Add column without NOT NULL constraint
  18. op.add_column('dataset_permissions', sa.Column('tenant_id', sa.UUID(), nullable=False))
  19. # ### end Alembic commands ###
  20. def downgrade():
  21. # ### commands auto generated by Alembic - please adjust! ###
  22. with op.batch_alter_table('dataset_permissions', schema=None) as batch_op:
  23. batch_op.drop_column('tenant_id')
  24. # ### end Alembic commands ###