"""Remove Nextcloud-specific columns from members and bands. Prior to this migration, storage credentials lived directly on the Member and Band rows. They are now in the band_storage table (migration 0007), encrypted at the application layer. Run 0007 first; if you still need to migrate existing data, do it in a separate script before applying this migration. Revision ID: 0008_drop_nc_columns Revises: 0007_band_storage Create Date: 2026-04-10 """ from alembic import op import sqlalchemy as sa revision = "0008_drop_nc_columns" down_revision = "0007_band_storage" branch_labels = None depends_on = None def upgrade() -> None: # Drop Nextcloud credential columns from members op.drop_column("members", "nc_url") op.drop_column("members", "nc_username") op.drop_column("members", "nc_password") # Drop Nextcloud-specific columns from bands op.drop_column("bands", "nc_folder_path") op.drop_column("bands", "nc_user") def downgrade() -> None: # Restore columns (data is lost — this is intentional) op.add_column("bands", sa.Column("nc_user", sa.String(255), nullable=True)) op.add_column("bands", sa.Column("nc_folder_path", sa.Text, nullable=True)) op.add_column("members", sa.Column("nc_password", sa.Text, nullable=True)) op.add_column("members", sa.Column("nc_username", sa.String(255), nullable=True)) op.add_column("members", sa.Column("nc_url", sa.Text, nullable=True))