"""Consolidated schema — single migration replacing the previous chain. All tables, indexes, and constraints generated from the current ORM models. """ from __future__ import annotations from alembic import op import sqlalchemy as sa revision = "0001" down_revision = None branch_labels = None depends_on = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.create_table('muse_objects', sa.Column('object_id', sa.String(length=128), nullable=False), sa.Column('size_bytes', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.PrimaryKeyConstraint('object_id') ) op.create_table('muse_snapshots', sa.Column('snapshot_id', sa.String(length=128), nullable=False), sa.Column('manifest', sa.JSON(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.PrimaryKeyConstraint('snapshot_id') ) op.create_table('musehub_attestations', sa.Column('attestation_id', sa.String(length=128), nullable=False), sa.Column('attester', sa.String(length=64), nullable=False), sa.Column('subject', sa.String(length=64), nullable=False), sa.Column('claim', sa.Text(), nullable=False), sa.Column('signature', sa.String(length=128), nullable=False), sa.Column('attester_public_key', sa.String(length=128), nullable=False), sa.Column('issued_at', sa.DateTime(timezone=True), nullable=False), sa.Column('revoked_at', sa.DateTime(timezone=True), nullable=True), sa.PrimaryKeyConstraint('attestation_id') ) op.create_index('ix_musehub_attestations_attester', 'musehub_attestations', ['attester'], unique=False) op.create_index('ix_musehub_attestations_subject', 'musehub_attestations', ['subject'], unique=False) op.create_table('musehub_auth_challenges', sa.Column('challenge_id', sa.String(length=36), nullable=False), sa.Column('nonce_hex', sa.String(length=64), nullable=False), sa.Column('fingerprint', sa.String(length=71), nullable=False), sa.Column('algorithm', sa.String(length=32), nullable=False), sa.Column('expires_at', sa.DateTime(timezone=True), nullable=False), sa.PrimaryKeyConstraint('challenge_id'), sa.UniqueConstraint('nonce_hex', name='uq_musehub_auth_challenges_nonce_hex') ) op.create_index('ix_musehub_auth_challenges_expires_at', 'musehub_auth_challenges', ['expires_at'], unique=False) op.create_table('musehub_domain_installs', sa.Column('install_id', sa.String(length=36), nullable=False), sa.Column('user_id', sa.String(length=128), nullable=False), sa.Column('domain_id', sa.String(length=128), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.PrimaryKeyConstraint('install_id'), sa.UniqueConstraint('user_id', 'domain_id', name='uq_musehub_domain_installs') ) op.create_index(op.f('ix_musehub_domain_installs_domain_id'), 'musehub_domain_installs', ['domain_id'], unique=False) op.create_index(op.f('ix_musehub_domain_installs_user_id'), 'musehub_domain_installs', ['user_id'], unique=False) op.create_table('musehub_domains', sa.Column('domain_id', sa.String(length=128), nullable=False), sa.Column('author_user_id', sa.String(length=128), nullable=True), sa.Column('author_slug', sa.String(length=64), nullable=False), sa.Column('slug', sa.String(length=64), nullable=False), sa.Column('display_name', sa.String(length=255), nullable=False), sa.Column('description', sa.Text(), nullable=False), sa.Column('version', sa.String(length=32), nullable=False), sa.Column('manifest_hash', sa.String(length=128), nullable=False), sa.Column('capabilities', sa.JSON(), nullable=False), sa.Column('viewer_type', sa.String(length=64), nullable=False), sa.Column('install_count', sa.Integer(), nullable=False), sa.Column('is_verified', sa.Boolean(), nullable=False), sa.Column('is_deprecated', sa.Boolean(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), sa.PrimaryKeyConstraint('domain_id'), sa.UniqueConstraint('author_slug', 'slug', name='uq_musehub_domains_author_slug') ) op.create_index(op.f('ix_musehub_domains_author_slug'), 'musehub_domains', ['author_slug'], unique=False) op.create_index(op.f('ix_musehub_domains_author_user_id'), 'musehub_domains', ['author_user_id'], unique=False) op.create_index(op.f('ix_musehub_domains_slug'), 'musehub_domains', ['slug'], unique=False) op.create_table('musehub_identities', sa.Column('identity_id', sa.String(length=128), nullable=False), sa.Column('handle', sa.String(length=64), nullable=False), sa.Column('identity_type', sa.String(length=16), nullable=False), sa.Column('display_name', sa.String(length=255), nullable=True), sa.Column('bio', sa.Text(), nullable=True), sa.Column('avatar_url', sa.String(length=2048), nullable=True), sa.Column('website_url', sa.String(length=2048), nullable=True), sa.Column('email', sa.String(length=255), nullable=True), sa.Column('agent_model', sa.String(length=255), nullable=True), sa.Column('agent_capabilities', sa.JSON(), nullable=False), sa.Column('location', sa.String(length=255), nullable=True), sa.Column('social_url', sa.String(length=2048), nullable=True), sa.Column('is_verified', sa.Boolean(), nullable=False), sa.Column('cc_license', sa.String(length=50), nullable=True), sa.Column('pinned_repo_ids', sa.JSON(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True), sa.Column('spawned_by', sa.String(length=64), nullable=True), sa.Column('scope', sa.JSON(), nullable=True), sa.Column('expires_at', sa.DateTime(timezone=True), nullable=True), sa.Column('tos_accepted_at', sa.DateTime(timezone=True), nullable=True), sa.Column('tos_version', sa.String(length=16), nullable=True), sa.Column('avax_address', sa.String(length=64), nullable=True), sa.Column('org_members', sa.JSON(), nullable=True), sa.Column('org_quorum', sa.Integer(), nullable=True), sa.Column('org_treasury_address', sa.String(length=64), nullable=True), sa.PrimaryKeyConstraint('identity_id'), sa.UniqueConstraint('handle', name='uq_musehub_identities_handle') ) op.create_index(op.f('ix_musehub_identities_email'), 'musehub_identities', ['email'], unique=False) op.create_index(op.f('ix_musehub_identities_expires_at'), 'musehub_identities', ['expires_at'], unique=False) op.create_index(op.f('ix_musehub_identities_handle'), 'musehub_identities', ['handle'], unique=False) op.create_index(op.f('ix_musehub_identities_is_verified'), 'musehub_identities', ['is_verified'], unique=False) op.create_index(op.f('ix_musehub_identities_spawned_by'), 'musehub_identities', ['spawned_by'], unique=False) op.create_table('musehub_mpay_claims', sa.Column('claim_id', sa.String(length=128), nullable=False), sa.Column('sender', sa.String(length=64), nullable=False), sa.Column('recipient', sa.String(length=64), nullable=False), sa.Column('amount_nano', sa.Integer(), nullable=False), sa.Column('nonce_hex', sa.String(length=64), nullable=False), sa.Column('signature', sa.String(length=128), nullable=False), sa.Column('sender_public_key', sa.String(length=128), nullable=False), sa.Column('memo', sa.String(length=500), nullable=True), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('confirmed_at', sa.DateTime(timezone=True), nullable=True), sa.Column('voided_at', sa.DateTime(timezone=True), nullable=True), sa.PrimaryKeyConstraint('claim_id'), sa.UniqueConstraint('nonce_hex'), sa.UniqueConstraint('nonce_hex', name='uq_musehub_mpay_claims_nonce') ) op.create_index('ix_musehub_mpay_claims_recipient', 'musehub_mpay_claims', ['recipient'], unique=False) op.create_index('ix_musehub_mpay_claims_sender', 'musehub_mpay_claims', ['sender'], unique=False) op.create_table('musehub_objects', sa.Column('object_id', sa.String(length=128), nullable=False), sa.Column('path', sa.String(length=1024), nullable=False), sa.Column('size_bytes', sa.Integer(), nullable=False), sa.Column('storage_uri', sa.String(length=2048), nullable=True), sa.Column('content_cache', sa.LargeBinary(), nullable=True), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True), sa.PrimaryKeyConstraint('object_id') ) op.create_table('musehub_profile_snapshots', sa.Column('handle', sa.String(length=64), nullable=False), sa.Column('data_json', sa.Text(), nullable=False), sa.Column('computed_at', sa.DateTime(timezone=True), nullable=False), sa.Column('is_stale', sa.Boolean(), nullable=False), sa.PrimaryKeyConstraint('handle') ) op.create_table('musehub_repos', sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('name', sa.String(length=255), nullable=False), sa.Column('owner', sa.String(length=64), nullable=False), sa.Column('slug', sa.String(length=64), nullable=False), sa.Column('visibility', sa.String(length=20), nullable=False), sa.Column('owner_user_id', sa.String(length=128), nullable=False), sa.Column('description', sa.Text(), nullable=False), sa.Column('tags', sa.JSON(), nullable=False), sa.Column('domain_id', sa.String(length=128), nullable=True), sa.Column('domain_meta', sa.JSON(), nullable=False), sa.Column('settings', sa.JSON(), nullable=True), sa.Column('default_branch', sa.String(length=255), nullable=False), sa.Column('pushed_at', sa.DateTime(timezone=True), nullable=True), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), sa.Column('training_opt_out', sa.Boolean(), nullable=False), sa.PrimaryKeyConstraint('repo_id'), sa.UniqueConstraint('owner', 'slug', name='uq_musehub_repos_owner_slug') ) op.create_index(op.f('ix_musehub_repos_domain_id'), 'musehub_repos', ['domain_id'], unique=False) op.create_index(op.f('ix_musehub_repos_owner'), 'musehub_repos', ['owner'], unique=False) op.create_index(op.f('ix_musehub_repos_owner_user_id'), 'musehub_repos', ['owner_user_id'], unique=False) op.create_index('ix_musehub_repos_owner_visibility', 'musehub_repos', ['owner', 'visibility'], unique=False) op.create_index(op.f('ix_musehub_repos_slug'), 'musehub_repos', ['slug'], unique=False) op.create_table('muse_commits', sa.Column('commit_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('branch', sa.String(length=255), nullable=False), sa.Column('parent_commit_id', sa.String(length=128), nullable=True), sa.Column('parent2_commit_id', sa.String(length=128), nullable=True), sa.Column('snapshot_id', sa.String(length=128), nullable=False), sa.Column('message', sa.Text(), nullable=False), sa.Column('author', sa.String(length=255), nullable=False), sa.Column('committed_at', sa.DateTime(timezone=True), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('commit_metadata', sa.JSON(), nullable=True), sa.ForeignKeyConstraint(['snapshot_id'], ['muse_snapshots.snapshot_id'], ondelete='RESTRICT'), sa.PrimaryKeyConstraint('commit_id') ) op.create_index(op.f('ix_muse_commits_parent2_commit_id'), 'muse_commits', ['parent2_commit_id'], unique=False) op.create_index(op.f('ix_muse_commits_parent_commit_id'), 'muse_commits', ['parent_commit_id'], unique=False) op.create_index(op.f('ix_muse_commits_repo_id'), 'muse_commits', ['repo_id'], unique=False) op.create_table('musehub_auth_keys', sa.Column('key_id', sa.String(length=128), nullable=False), sa.Column('identity_id', sa.String(length=128), nullable=False), sa.Column('algorithm', sa.String(length=32), nullable=False), sa.Column('public_key_b64', sa.Text(), nullable=False), sa.Column('fingerprint', sa.String(length=71), nullable=False), sa.Column('label', sa.String(length=255), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('last_used_at', sa.DateTime(timezone=True), nullable=True), sa.ForeignKeyConstraint(['identity_id'], ['musehub_identities.identity_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('key_id'), sa.UniqueConstraint('fingerprint', name='uq_musehub_auth_keys_fingerprint') ) op.create_index('ix_musehub_auth_keys_algorithm', 'musehub_auth_keys', ['algorithm'], unique=False) op.create_index('ix_musehub_auth_keys_identity_id', 'musehub_auth_keys', ['identity_id'], unique=False) op.create_table('musehub_background_jobs', sa.Column('job_id', sa.String(length=36), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('job_type', sa.String(length=64), nullable=False), sa.Column('payload', sa.JSON(), nullable=False), sa.Column('status', sa.String(length=16), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('claimed_at', sa.DateTime(timezone=True), nullable=True), sa.Column('done_at', sa.DateTime(timezone=True), nullable=True), sa.Column('attempt', sa.Integer(), nullable=False), sa.Column('error', sa.Text(), nullable=True), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('job_id') ) op.create_index(op.f('ix_musehub_background_jobs_repo_id'), 'musehub_background_jobs', ['repo_id'], unique=False) op.create_index(op.f('ix_musehub_background_jobs_status'), 'musehub_background_jobs', ['status'], unique=False) op.create_index('ix_musehub_background_jobs_status_created', 'musehub_background_jobs', ['status', 'created_at'], unique=False) op.create_table('musehub_branches', sa.Column('branch_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('name', sa.String(length=255), nullable=False), sa.Column('head_commit_id', sa.String(length=128), nullable=True), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('branch_id') ) op.create_index(op.f('ix_musehub_branches_repo_id'), 'musehub_branches', ['repo_id'], unique=False) op.create_table('musehub_collaborators', sa.Column('id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('identity_handle', sa.String(length=64), nullable=False), sa.Column('permission', sa.String(length=20), nullable=False), sa.Column('invited_by_handle', sa.String(length=64), nullable=True), sa.Column('invited_at', sa.DateTime(timezone=True), nullable=False), sa.Column('accepted_at', sa.DateTime(timezone=True), nullable=True), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('repo_id', 'identity_handle', name='uq_musehub_collaborators_repo_identity') ) op.create_index('ix_musehub_collaborators_identity_handle', 'musehub_collaborators', ['identity_handle'], unique=False) op.create_index('ix_musehub_collaborators_repo_id', 'musehub_collaborators', ['repo_id'], unique=False) op.create_table('musehub_commits', sa.Column('commit_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('branch', sa.String(length=255), nullable=False), sa.Column('parent_ids', sa.JSON(), nullable=False), sa.Column('message', sa.Text(), nullable=False), sa.Column('author', sa.String(length=255), nullable=False), sa.Column('timestamp', sa.DateTime(timezone=True), nullable=False), sa.Column('snapshot_id', sa.String(length=128), nullable=True), sa.Column('commit_meta', sa.JSON(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('commit_id') ) op.create_index(op.f('ix_musehub_commits_branch'), 'musehub_commits', ['branch'], unique=False) op.create_index('ix_musehub_commits_repo_branch', 'musehub_commits', ['repo_id', 'branch'], unique=False) op.create_index(op.f('ix_musehub_commits_repo_id'), 'musehub_commits', ['repo_id'], unique=False) op.create_index('ix_musehub_commits_repo_timestamp', 'musehub_commits', ['repo_id', 'timestamp'], unique=False) op.create_index(op.f('ix_musehub_commits_timestamp'), 'musehub_commits', ['timestamp'], unique=False) op.create_table('musehub_coord_records', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('kind', sa.String(length=32), nullable=False), sa.Column('record_uuid', sa.String(length=36), nullable=False), sa.Column('run_id', sa.String(length=255), nullable=False), sa.Column('payload', sa.JSON(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('expires_at', sa.DateTime(timezone=True), nullable=True), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('repo_id', 'kind', 'record_uuid', name='uq_coord_repo_kind_uuid') ) op.create_index('ix_coord_repo_id_cursor', 'musehub_coord_records', ['repo_id', 'id'], unique=False) op.create_index('ix_coord_repo_kind_id', 'musehub_coord_records', ['repo_id', 'kind', 'id'], unique=False) op.create_index(op.f('ix_musehub_coord_records_repo_id'), 'musehub_coord_records', ['repo_id'], unique=False) op.create_table('musehub_coord_reservations', sa.Column('reservation_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('symbol_address', sa.String(length=512), nullable=False), sa.Column('agent_id', sa.String(length=255), nullable=False), sa.Column('agent_model_id', sa.String(length=255), nullable=False), sa.Column('ttl_s', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('expires_at', sa.DateTime(timezone=True), nullable=False), sa.Column('released_at', sa.DateTime(timezone=True), nullable=True), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('reservation_id') ) op.create_index(op.f('ix_musehub_coord_reservations_repo_id'), 'musehub_coord_reservations', ['repo_id'], unique=False) op.create_table('musehub_coord_tasks', sa.Column('task_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('queue', sa.String(length=255), nullable=False), sa.Column('priority', sa.Integer(), nullable=False), sa.Column('payload', sa.JSON(), nullable=False), sa.Column('status', sa.String(length=20), nullable=False), sa.Column('claimed_by', sa.String(length=255), nullable=True), sa.Column('claimed_at', sa.DateTime(timezone=True), nullable=True), sa.Column('completed_at', sa.DateTime(timezone=True), nullable=True), sa.Column('depends_on', sa.JSON(), nullable=False), sa.Column('run_id', sa.String(length=255), nullable=True), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('task_id') ) op.create_index('ix_coord_tasks_repo_priority', 'musehub_coord_tasks', ['repo_id', 'priority'], unique=False) op.create_index('ix_coord_tasks_repo_queue_status', 'musehub_coord_tasks', ['repo_id', 'queue', 'status'], unique=False) op.create_index(op.f('ix_musehub_coord_tasks_repo_id'), 'musehub_coord_tasks', ['repo_id'], unique=False) op.create_index(op.f('ix_musehub_coord_tasks_status'), 'musehub_coord_tasks', ['status'], unique=False) op.create_table('musehub_forks', sa.Column('fork_id', sa.String(length=128), nullable=False), sa.Column('source_repo_id', sa.String(length=128), nullable=False), sa.Column('fork_repo_id', sa.String(length=128), nullable=False), sa.Column('forked_by', sa.String(length=255), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['fork_repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['source_repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('fork_id'), sa.UniqueConstraint('source_repo_id', 'forked_by', name='uq_musehub_forks') ) op.create_index(op.f('ix_musehub_forks_fork_repo_id'), 'musehub_forks', ['fork_repo_id'], unique=False) op.create_index(op.f('ix_musehub_forks_forked_by'), 'musehub_forks', ['forked_by'], unique=False) op.create_index(op.f('ix_musehub_forks_source_repo_id'), 'musehub_forks', ['source_repo_id'], unique=False) op.create_table('musehub_intel_results', sa.Column('result_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('intel_type', sa.String(length=128), nullable=False), sa.Column('domain', sa.String(length=64), nullable=False), sa.Column('ref', sa.String(length=128), nullable=False), sa.Column('data_json', sa.Text(), nullable=False), sa.Column('schema_version', sa.Integer(), nullable=False), sa.Column('computed_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('result_id'), sa.UniqueConstraint('repo_id', 'intel_type', name='uq_musehub_intel_results_repo_type') ) op.create_index(op.f('ix_musehub_intel_results_domain'), 'musehub_intel_results', ['domain'], unique=False) op.create_index(op.f('ix_musehub_intel_results_intel_type'), 'musehub_intel_results', ['intel_type'], unique=False) op.create_index(op.f('ix_musehub_intel_results_repo_id'), 'musehub_intel_results', ['repo_id'], unique=False) op.create_index('ix_musehub_intel_results_repo_type', 'musehub_intel_results', ['repo_id', 'intel_type'], unique=False) op.create_table('musehub_issues', sa.Column('issue_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('number', sa.Integer(), nullable=False), sa.Column('title', sa.String(length=500), nullable=False), sa.Column('body', sa.Text(), nullable=False), sa.Column('state', sa.String(length=20), nullable=False), sa.Column('labels', sa.JSON(), nullable=False), sa.Column('symbol_anchors', sa.JSON(), nullable=False), sa.Column('commit_anchors', sa.JSON(), nullable=False), sa.Column('author', sa.String(length=255), nullable=False), sa.Column('assignee', sa.String(length=255), nullable=True), sa.Column('agent_id', sa.String(length=255), nullable=False), sa.Column('model_id', sa.String(length=255), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('issue_id') ) op.create_index(op.f('ix_musehub_issues_number'), 'musehub_issues', ['number'], unique=False) op.create_index(op.f('ix_musehub_issues_repo_id'), 'musehub_issues', ['repo_id'], unique=False) op.create_index('ix_musehub_issues_repo_number', 'musehub_issues', ['repo_id', 'number'], unique=False) op.create_index('ix_musehub_issues_repo_state', 'musehub_issues', ['repo_id', 'state'], unique=False) op.create_index(op.f('ix_musehub_issues_state'), 'musehub_issues', ['state'], unique=False) op.create_table('musehub_labels', sa.Column('id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('name', sa.String(length=50), nullable=False), sa.Column('color', sa.String(length=7), nullable=False), sa.Column('description', sa.String(length=200), nullable=True), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('repo_id', 'name', name='uq_musehub_labels_repo_name') ) op.create_index('ix_musehub_labels_repo_id', 'musehub_labels', ['repo_id'], unique=False) op.create_table('musehub_mists', sa.Column('mist_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('owner', sa.String(length=64), nullable=False), sa.Column('artifact_type', sa.String(length=20), nullable=False), sa.Column('language', sa.String(length=64), nullable=False), sa.Column('filename', sa.String(length=255), nullable=False), sa.Column('title', sa.String(length=500), nullable=False), sa.Column('description', sa.Text(), nullable=False), sa.Column('content', sa.Text(), nullable=False), sa.Column('size_bytes', sa.Integer(), nullable=False), sa.Column('commit_id', sa.String(length=128), nullable=True), sa.Column('snapshot_id', sa.String(length=128), nullable=True), sa.Column('version', sa.Integer(), nullable=False), sa.Column('agent_id', sa.String(length=255), nullable=False), sa.Column('model_id', sa.String(length=255), nullable=False), sa.Column('gpg_signature', sa.Text(), nullable=True), sa.Column('fork_parent_id', sa.String(length=128), nullable=True), sa.Column('fork_depth', sa.Integer(), nullable=False), sa.Column('fork_count', sa.Integer(), nullable=False), sa.Column('view_count', sa.Integer(), nullable=False), sa.Column('embed_count', sa.Integer(), nullable=False), sa.Column('visibility', sa.String(length=10), nullable=False), sa.Column('tags', sa.JSON(), nullable=False), sa.Column('symbol_anchors', sa.JSON(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['fork_parent_id'], ['musehub_mists.mist_id'], ondelete='SET NULL'), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('mist_id') ) op.create_index(op.f('ix_musehub_mists_artifact_type'), 'musehub_mists', ['artifact_type'], unique=False) op.create_index('ix_musehub_mists_artifact_type_created_at', 'musehub_mists', ['artifact_type', 'created_at'], unique=False) op.create_index('ix_musehub_mists_fork_parent_id', 'musehub_mists', ['fork_parent_id'], unique=False) op.create_index(op.f('ix_musehub_mists_owner'), 'musehub_mists', ['owner'], unique=False) op.create_index('ix_musehub_mists_owner_created_at', 'musehub_mists', ['owner', 'created_at'], unique=False) op.create_index('ix_musehub_mists_owner_visibility', 'musehub_mists', ['owner', 'visibility'], unique=False) op.create_index(op.f('ix_musehub_mists_repo_id'), 'musehub_mists', ['repo_id'], unique=False) op.create_table('musehub_object_refs', sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('object_id', sa.String(length=128), nullable=False), sa.ForeignKeyConstraint(['object_id'], ['musehub_objects.object_id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('repo_id', 'object_id') ) op.create_table('musehub_proposals', sa.Column('proposal_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('proposal_number', sa.Integer(), nullable=False), sa.Column('title', sa.String(length=500), nullable=False), sa.Column('body', sa.Text(), nullable=False), sa.Column('state', sa.String(length=20), nullable=False), sa.Column('from_branch', sa.String(length=255), nullable=False), sa.Column('to_branch', sa.String(length=255), nullable=False), sa.Column('merge_commit_id', sa.String(length=128), nullable=True), sa.Column('merged_at', sa.DateTime(timezone=True), nullable=True), sa.Column('author', sa.String(length=255), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), sa.Column('domain_diff', sa.JSON(), nullable=True), sa.Column('risk_score', sa.Float(), nullable=True), sa.Column('blast_delta', sa.Float(), nullable=True), sa.Column('breakage_count', sa.Integer(), nullable=False), sa.Column('test_gap_count', sa.Integer(), nullable=False), sa.Column('symbols_changed', sa.Integer(), nullable=False), sa.Column('touched_symbols', sa.JSON(), nullable=False), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('proposal_id') ) op.create_index(op.f('ix_musehub_proposals_repo_id'), 'musehub_proposals', ['repo_id'], unique=False) op.create_index('ix_musehub_proposals_repo_number', 'musehub_proposals', ['repo_id', 'proposal_number'], unique=False) op.create_index('ix_musehub_proposals_repo_state', 'musehub_proposals', ['repo_id', 'state'], unique=False) op.create_index(op.f('ix_musehub_proposals_state'), 'musehub_proposals', ['state'], unique=False) op.create_table('musehub_releases', sa.Column('release_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('tag', sa.String(length=100), nullable=False), sa.Column('title', sa.String(length=500), nullable=False), sa.Column('body', sa.Text(), nullable=False), sa.Column('commit_id', sa.String(length=128), nullable=True), sa.Column('snapshot_id', sa.String(length=128), nullable=True), sa.Column('semver_major', sa.Integer(), nullable=False), sa.Column('semver_minor', sa.Integer(), nullable=False), sa.Column('semver_patch', sa.Integer(), nullable=False), sa.Column('semver_pre', sa.String(length=255), nullable=False), sa.Column('semver_build', sa.String(length=255), nullable=False), sa.Column('channel', sa.String(length=20), nullable=False), sa.Column('download_urls', sa.JSON(), nullable=False), sa.Column('author', sa.String(length=255), nullable=False), sa.Column('agent_id', sa.String(length=255), nullable=False), sa.Column('model_id', sa.String(length=255), nullable=False), sa.Column('changelog_json', sa.Text(), nullable=False), sa.Column('is_draft', sa.Boolean(), nullable=False), sa.Column('gpg_signature', sa.Text(), nullable=True), sa.Column('semantic_report_json', sa.Text(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('release_id'), sa.UniqueConstraint('repo_id', 'tag', name='uq_musehub_releases_repo_tag') ) op.create_index(op.f('ix_musehub_releases_channel'), 'musehub_releases', ['channel'], unique=False) op.create_index(op.f('ix_musehub_releases_repo_id'), 'musehub_releases', ['repo_id'], unique=False) op.create_index(op.f('ix_musehub_releases_tag'), 'musehub_releases', ['tag'], unique=False) op.create_table('musehub_sessions', sa.Column('session_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('schema_version', sa.String(length=10), nullable=False), sa.Column('started_at', sa.DateTime(timezone=True), nullable=False), sa.Column('ended_at', sa.DateTime(timezone=True), nullable=True), sa.Column('participants', sa.JSON(), nullable=False), sa.Column('location', sa.String(length=500), nullable=False), sa.Column('intent', sa.Text(), nullable=False), sa.Column('commits', sa.JSON(), nullable=False), sa.Column('notes', sa.Text(), nullable=False), sa.Column('is_active', sa.Boolean(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('session_id') ) op.create_index(op.f('ix_musehub_sessions_is_active'), 'musehub_sessions', ['is_active'], unique=False) op.create_index(op.f('ix_musehub_sessions_repo_id'), 'musehub_sessions', ['repo_id'], unique=False) op.create_index(op.f('ix_musehub_sessions_started_at'), 'musehub_sessions', ['started_at'], unique=False) op.create_table('musehub_snapshots', sa.Column('snapshot_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('directories', sa.JSON(), nullable=False), sa.Column('manifest_blob', sa.LargeBinary(), nullable=False), sa.Column('entry_count', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('snapshot_id') ) op.create_index(op.f('ix_musehub_snapshots_repo_id'), 'musehub_snapshots', ['repo_id'], unique=False) op.create_table('musehub_webhooks', sa.Column('webhook_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('url', sa.String(length=2048), nullable=False), sa.Column('events', sa.JSON(), nullable=False), sa.Column('secret', sa.Text(), nullable=False), sa.Column('active', sa.Boolean(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('webhook_id') ) op.create_index(op.f('ix_musehub_webhooks_repo_id'), 'musehub_webhooks', ['repo_id'], unique=False) op.create_table('musehub_wire_tags', sa.Column('tag_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('commit_id', sa.String(length=128), nullable=False), sa.Column('tag', sa.String(length=500), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('tag_id'), sa.UniqueConstraint('repo_id', 'tag', name='uq_musehub_wire_tags_repo_tag') ) op.create_index(op.f('ix_musehub_wire_tags_repo_id'), 'musehub_wire_tags', ['repo_id'], unique=False) op.create_index(op.f('ix_musehub_wire_tags_tag'), 'musehub_wire_tags', ['tag'], unique=False) op.create_table('muse_tags', sa.Column('tag_id', sa.String(length=36), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('commit_id', sa.String(length=128), nullable=False), sa.Column('tag', sa.Text(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['commit_id'], ['muse_commits.commit_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('tag_id') ) op.create_index(op.f('ix_muse_tags_commit_id'), 'muse_tags', ['commit_id'], unique=False) op.create_index(op.f('ix_muse_tags_repo_id'), 'muse_tags', ['repo_id'], unique=False) op.create_index(op.f('ix_muse_tags_tag'), 'muse_tags', ['tag'], unique=False) op.create_table('musehub_issue_comments', sa.Column('comment_id', sa.String(length=128), nullable=False), sa.Column('issue_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('author', sa.String(length=255), nullable=False), sa.Column('body', sa.Text(), nullable=False), sa.Column('parent_id', sa.String(length=128), nullable=True), sa.Column('is_deleted', sa.Boolean(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['issue_id'], ['musehub_issues.issue_id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('comment_id') ) op.create_index(op.f('ix_musehub_issue_comments_created_at'), 'musehub_issue_comments', ['created_at'], unique=False) op.create_index(op.f('ix_musehub_issue_comments_issue_id'), 'musehub_issue_comments', ['issue_id'], unique=False) op.create_index(op.f('ix_musehub_issue_comments_parent_id'), 'musehub_issue_comments', ['parent_id'], unique=False) op.create_index(op.f('ix_musehub_issue_comments_repo_id'), 'musehub_issue_comments', ['repo_id'], unique=False) op.create_table('musehub_issue_events', sa.Column('event_id', sa.String(length=36), nullable=False), sa.Column('issue_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('actor', sa.String(length=255), nullable=False), sa.Column('event_type', sa.String(length=64), nullable=False), sa.Column('payload', sa.JSON(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['issue_id'], ['musehub_issues.issue_id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('event_id') ) op.create_index(op.f('ix_musehub_issue_events_created_at'), 'musehub_issue_events', ['created_at'], unique=False) op.create_index('ix_musehub_issue_events_issue_created', 'musehub_issue_events', ['issue_id', 'created_at'], unique=False) op.create_index(op.f('ix_musehub_issue_events_issue_id'), 'musehub_issue_events', ['issue_id'], unique=False) op.create_index(op.f('ix_musehub_issue_events_repo_id'), 'musehub_issue_events', ['repo_id'], unique=False) op.create_table('musehub_issue_labels', sa.Column('issue_id', sa.String(length=128), nullable=False), sa.Column('label_id', sa.String(length=128), nullable=False), sa.ForeignKeyConstraint(['issue_id'], ['musehub_issues.issue_id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['label_id'], ['musehub_labels.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('issue_id', 'label_id') ) op.create_index('ix_musehub_issue_labels_label_id', 'musehub_issue_labels', ['label_id'], unique=False) op.create_table('musehub_proposal_comments', sa.Column('comment_id', sa.String(length=128), nullable=False), sa.Column('proposal_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('author', sa.String(length=255), nullable=False), sa.Column('body', sa.Text(), nullable=False), sa.Column('dimension_ref', sa.JSON(), nullable=False), sa.Column('symbol_address', sa.String(length=512), nullable=True), sa.Column('parent_comment_id', sa.String(length=128), nullable=True), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['proposal_id'], ['musehub_proposals.proposal_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('comment_id') ) op.create_index(op.f('ix_musehub_proposal_comments_created_at'), 'musehub_proposal_comments', ['created_at'], unique=False) op.create_index(op.f('ix_musehub_proposal_comments_parent_comment_id'), 'musehub_proposal_comments', ['parent_comment_id'], unique=False) op.create_index(op.f('ix_musehub_proposal_comments_proposal_id'), 'musehub_proposal_comments', ['proposal_id'], unique=False) op.create_index(op.f('ix_musehub_proposal_comments_repo_id'), 'musehub_proposal_comments', ['repo_id'], unique=False) op.create_table('musehub_proposal_labels', sa.Column('proposal_id', sa.String(length=128), nullable=False), sa.Column('label_id', sa.String(length=128), nullable=False), sa.ForeignKeyConstraint(['label_id'], ['musehub_labels.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['proposal_id'], ['musehub_proposals.proposal_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('proposal_id', 'label_id') ) op.create_index('ix_musehub_proposal_labels_label_id', 'musehub_proposal_labels', ['label_id'], unique=False) op.create_table('musehub_proposal_reviews', sa.Column('review_id', sa.String(length=128), nullable=False), sa.Column('proposal_id', sa.String(length=128), nullable=False), sa.Column('reviewer_username', sa.String(length=255), nullable=False), sa.Column('state', sa.String(length=30), nullable=False), sa.Column('body', sa.Text(), nullable=True), sa.Column('submitted_at', sa.DateTime(timezone=True), nullable=True), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['proposal_id'], ['musehub_proposals.proposal_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('review_id') ) op.create_index(op.f('ix_musehub_proposal_reviews_proposal_id'), 'musehub_proposal_reviews', ['proposal_id'], unique=False) op.create_index(op.f('ix_musehub_proposal_reviews_reviewer_username'), 'musehub_proposal_reviews', ['reviewer_username'], unique=False) op.create_index(op.f('ix_musehub_proposal_reviews_state'), 'musehub_proposal_reviews', ['state'], unique=False) op.create_table('musehub_release_assets', sa.Column('asset_id', sa.String(length=128), nullable=False), sa.Column('release_id', sa.String(length=128), nullable=False), sa.Column('repo_id', sa.String(length=128), nullable=False), sa.Column('name', sa.String(length=500), nullable=False), sa.Column('label', sa.String(length=255), nullable=False), sa.Column('content_type', sa.String(length=128), nullable=False), sa.Column('size', sa.Integer(), nullable=False), sa.Column('download_url', sa.String(length=2048), nullable=False), sa.Column('download_count', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['release_id'], ['musehub_releases.release_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('asset_id') ) op.create_index(op.f('ix_musehub_release_assets_release_id'), 'musehub_release_assets', ['release_id'], unique=False) op.create_index(op.f('ix_musehub_release_assets_repo_id'), 'musehub_release_assets', ['repo_id'], unique=False) op.create_table('musehub_snapshot_entries', sa.Column('snapshot_id', sa.String(length=128), nullable=False), sa.Column('path', sa.String(length=4096), nullable=False), sa.Column('object_id', sa.String(length=128), nullable=False), sa.Column('size_bytes', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['snapshot_id'], ['musehub_snapshots.snapshot_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('snapshot_id', 'path') ) op.create_table('musehub_webhook_deliveries', sa.Column('delivery_id', sa.String(length=36), nullable=False), sa.Column('webhook_id', sa.String(length=128), nullable=False), sa.Column('event_type', sa.String(length=64), nullable=False), sa.Column('payload', sa.Text(), nullable=False), sa.Column('attempt', sa.Integer(), nullable=False), sa.Column('success', sa.Boolean(), nullable=False), sa.Column('response_status', sa.Integer(), nullable=False), sa.Column('response_body', sa.Text(), nullable=False), sa.Column('delivered_at', sa.DateTime(timezone=True), nullable=False), sa.ForeignKeyConstraint(['webhook_id'], ['musehub_webhooks.webhook_id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('delivery_id') ) op.create_index(op.f('ix_musehub_webhook_deliveries_event_type'), 'musehub_webhook_deliveries', ['event_type'], unique=False) op.create_index(op.f('ix_musehub_webhook_deliveries_webhook_id'), 'musehub_webhook_deliveries', ['webhook_id'], unique=False) # ### end Alembic commands ### def downgrade() -> None: # Wrap drop operations with IF EXISTS so this base migration is idempotent # even if a later migration's downgrade already dropped some tables/indexes. from sqlalchemy import text as _text _conn = op.get_bind() def _safe_drop_index(name, **kw): _conn.execute(_text(f"DROP INDEX IF EXISTS {name}")) def _safe_drop_table(name, **kw): _conn.execute(_text(f"DROP TABLE IF EXISTS {name} CASCADE")) _orig_drop_index, _orig_drop_table = op.drop_index, op.drop_table op.drop_index, op.drop_table = _safe_drop_index, _safe_drop_table # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f('ix_musehub_webhook_deliveries_webhook_id'), table_name='musehub_webhook_deliveries') op.drop_index(op.f('ix_musehub_webhook_deliveries_event_type'), table_name='musehub_webhook_deliveries') op.drop_table('musehub_webhook_deliveries') op.drop_table('musehub_snapshot_entries') op.drop_index(op.f('ix_musehub_release_assets_repo_id'), table_name='musehub_release_assets') op.drop_index(op.f('ix_musehub_release_assets_release_id'), table_name='musehub_release_assets') op.drop_table('musehub_release_assets') op.drop_index(op.f('ix_musehub_proposal_reviews_state'), table_name='musehub_proposal_reviews') op.drop_index(op.f('ix_musehub_proposal_reviews_reviewer_username'), table_name='musehub_proposal_reviews') op.drop_index(op.f('ix_musehub_proposal_reviews_proposal_id'), table_name='musehub_proposal_reviews') op.drop_table('musehub_proposal_reviews') op.drop_index('ix_musehub_proposal_labels_label_id', table_name='musehub_proposal_labels') op.drop_table('musehub_proposal_labels') op.drop_index(op.f('ix_musehub_proposal_comments_repo_id'), table_name='musehub_proposal_comments') op.drop_index(op.f('ix_musehub_proposal_comments_proposal_id'), table_name='musehub_proposal_comments') op.drop_index(op.f('ix_musehub_proposal_comments_parent_comment_id'), table_name='musehub_proposal_comments') op.drop_index(op.f('ix_musehub_proposal_comments_created_at'), table_name='musehub_proposal_comments') op.drop_table('musehub_proposal_comments') op.drop_index('ix_musehub_issue_labels_label_id', table_name='musehub_issue_labels') op.drop_table('musehub_issue_labels') op.drop_index(op.f('ix_musehub_issue_events_repo_id'), table_name='musehub_issue_events') op.drop_index(op.f('ix_musehub_issue_events_issue_id'), table_name='musehub_issue_events') op.drop_index('ix_musehub_issue_events_issue_created', table_name='musehub_issue_events') op.drop_index(op.f('ix_musehub_issue_events_created_at'), table_name='musehub_issue_events') op.drop_table('musehub_issue_events') op.drop_index(op.f('ix_musehub_issue_comments_repo_id'), table_name='musehub_issue_comments') op.drop_index(op.f('ix_musehub_issue_comments_parent_id'), table_name='musehub_issue_comments') op.drop_index(op.f('ix_musehub_issue_comments_issue_id'), table_name='musehub_issue_comments') op.drop_index(op.f('ix_musehub_issue_comments_created_at'), table_name='musehub_issue_comments') op.drop_table('musehub_issue_comments') op.drop_index(op.f('ix_muse_tags_tag'), table_name='muse_tags') op.drop_index(op.f('ix_muse_tags_repo_id'), table_name='muse_tags') op.drop_index(op.f('ix_muse_tags_commit_id'), table_name='muse_tags') op.drop_table('muse_tags') op.drop_index(op.f('ix_musehub_wire_tags_tag'), table_name='musehub_wire_tags') op.drop_index(op.f('ix_musehub_wire_tags_repo_id'), table_name='musehub_wire_tags') op.drop_table('musehub_wire_tags') op.drop_index(op.f('ix_musehub_webhooks_repo_id'), table_name='musehub_webhooks') op.drop_table('musehub_webhooks') op.drop_index(op.f('ix_musehub_snapshots_repo_id'), table_name='musehub_snapshots') op.drop_table('musehub_snapshots') op.drop_index(op.f('ix_musehub_sessions_started_at'), table_name='musehub_sessions') op.drop_index(op.f('ix_musehub_sessions_repo_id'), table_name='musehub_sessions') op.drop_index(op.f('ix_musehub_sessions_is_active'), table_name='musehub_sessions') op.drop_table('musehub_sessions') op.drop_index(op.f('ix_musehub_releases_tag'), table_name='musehub_releases') op.drop_index(op.f('ix_musehub_releases_repo_id'), table_name='musehub_releases') op.drop_index(op.f('ix_musehub_releases_channel'), table_name='musehub_releases') op.drop_table('musehub_releases') op.drop_index(op.f('ix_musehub_proposals_state'), table_name='musehub_proposals') op.drop_index('ix_musehub_proposals_repo_state', table_name='musehub_proposals') op.drop_index('ix_musehub_proposals_repo_number', table_name='musehub_proposals') op.drop_index(op.f('ix_musehub_proposals_repo_id'), table_name='musehub_proposals') op.drop_table('musehub_proposals') op.drop_table('musehub_object_refs') op.drop_index(op.f('ix_musehub_mists_repo_id'), table_name='musehub_mists') op.drop_index('ix_musehub_mists_owner_visibility', table_name='musehub_mists') op.drop_index('ix_musehub_mists_owner_created_at', table_name='musehub_mists') op.drop_index(op.f('ix_musehub_mists_owner'), table_name='musehub_mists') op.drop_index('ix_musehub_mists_fork_parent_id', table_name='musehub_mists') op.drop_index('ix_musehub_mists_artifact_type_created_at', table_name='musehub_mists') op.drop_index(op.f('ix_musehub_mists_artifact_type'), table_name='musehub_mists') op.drop_table('musehub_mists') op.drop_index('ix_musehub_labels_repo_id', table_name='musehub_labels') op.drop_table('musehub_labels') op.drop_index(op.f('ix_musehub_issues_state'), table_name='musehub_issues') op.drop_index('ix_musehub_issues_repo_state', table_name='musehub_issues') op.drop_index('ix_musehub_issues_repo_number', table_name='musehub_issues') op.drop_index(op.f('ix_musehub_issues_repo_id'), table_name='musehub_issues') op.drop_index(op.f('ix_musehub_issues_number'), table_name='musehub_issues') op.drop_table('musehub_issues') op.drop_index('ix_musehub_intel_results_repo_type', table_name='musehub_intel_results') op.drop_index(op.f('ix_musehub_intel_results_repo_id'), table_name='musehub_intel_results') op.drop_index(op.f('ix_musehub_intel_results_intel_type'), table_name='musehub_intel_results') op.drop_index(op.f('ix_musehub_intel_results_domain'), table_name='musehub_intel_results') op.drop_table('musehub_intel_results') op.drop_index(op.f('ix_musehub_forks_source_repo_id'), table_name='musehub_forks') op.drop_index(op.f('ix_musehub_forks_forked_by'), table_name='musehub_forks') op.drop_index(op.f('ix_musehub_forks_fork_repo_id'), table_name='musehub_forks') op.drop_table('musehub_forks') op.drop_index(op.f('ix_musehub_coord_tasks_status'), table_name='musehub_coord_tasks') op.drop_index(op.f('ix_musehub_coord_tasks_repo_id'), table_name='musehub_coord_tasks') op.drop_index('ix_coord_tasks_repo_queue_status', table_name='musehub_coord_tasks') op.drop_index('ix_coord_tasks_repo_priority', table_name='musehub_coord_tasks') op.drop_table('musehub_coord_tasks') op.drop_index(op.f('ix_musehub_coord_reservations_repo_id'), table_name='musehub_coord_reservations') op.drop_table('musehub_coord_reservations') op.drop_index(op.f('ix_musehub_coord_records_repo_id'), table_name='musehub_coord_records') op.drop_index('ix_coord_repo_kind_id', table_name='musehub_coord_records') op.drop_index('ix_coord_repo_id_cursor', table_name='musehub_coord_records') op.drop_table('musehub_coord_records') op.drop_index(op.f('ix_musehub_commits_timestamp'), table_name='musehub_commits') op.drop_index('ix_musehub_commits_repo_timestamp', table_name='musehub_commits') op.drop_index(op.f('ix_musehub_commits_repo_id'), table_name='musehub_commits') op.drop_index('ix_musehub_commits_repo_branch', table_name='musehub_commits') op.drop_index(op.f('ix_musehub_commits_branch'), table_name='musehub_commits') op.drop_table('musehub_commits') op.drop_index('ix_musehub_collaborators_repo_id', table_name='musehub_collaborators') op.drop_index('ix_musehub_collaborators_identity_handle', table_name='musehub_collaborators') op.drop_table('musehub_collaborators') op.drop_index(op.f('ix_musehub_branches_repo_id'), table_name='musehub_branches') op.drop_table('musehub_branches') op.drop_index('ix_musehub_background_jobs_status_created', table_name='musehub_background_jobs') op.drop_index(op.f('ix_musehub_background_jobs_status'), table_name='musehub_background_jobs') op.drop_index(op.f('ix_musehub_background_jobs_repo_id'), table_name='musehub_background_jobs') op.drop_table('musehub_background_jobs') op.drop_index('ix_musehub_auth_keys_identity_id', table_name='musehub_auth_keys') op.drop_index('ix_musehub_auth_keys_algorithm', table_name='musehub_auth_keys') op.drop_table('musehub_auth_keys') op.drop_index(op.f('ix_muse_commits_repo_id'), table_name='muse_commits') op.drop_index(op.f('ix_muse_commits_parent_commit_id'), table_name='muse_commits') op.drop_index(op.f('ix_muse_commits_parent2_commit_id'), table_name='muse_commits') op.drop_table('muse_commits') op.drop_index(op.f('ix_musehub_repos_slug'), table_name='musehub_repos') op.drop_index('ix_musehub_repos_owner_visibility', table_name='musehub_repos') op.drop_index(op.f('ix_musehub_repos_owner_user_id'), table_name='musehub_repos') op.drop_index(op.f('ix_musehub_repos_owner'), table_name='musehub_repos') op.drop_index(op.f('ix_musehub_repos_domain_id'), table_name='musehub_repos') op.drop_table('musehub_repos') op.drop_table('musehub_profile_snapshots') op.drop_table('musehub_objects') op.drop_index('ix_musehub_mpay_claims_sender', table_name='musehub_mpay_claims') op.drop_index('ix_musehub_mpay_claims_recipient', table_name='musehub_mpay_claims') op.drop_table('musehub_mpay_claims') op.drop_index(op.f('ix_musehub_identities_spawned_by'), table_name='musehub_identities') op.drop_index(op.f('ix_musehub_identities_is_verified'), table_name='musehub_identities') op.drop_index(op.f('ix_musehub_identities_handle'), table_name='musehub_identities') op.drop_index(op.f('ix_musehub_identities_expires_at'), table_name='musehub_identities') op.drop_index(op.f('ix_musehub_identities_email'), table_name='musehub_identities') op.drop_table('musehub_identities') op.drop_index(op.f('ix_musehub_domains_slug'), table_name='musehub_domains') op.drop_index(op.f('ix_musehub_domains_author_user_id'), table_name='musehub_domains') op.drop_index(op.f('ix_musehub_domains_author_slug'), table_name='musehub_domains') op.drop_table('musehub_domains') op.drop_index(op.f('ix_musehub_domain_installs_user_id'), table_name='musehub_domain_installs') op.drop_index(op.f('ix_musehub_domain_installs_domain_id'), table_name='musehub_domain_installs') op.drop_table('musehub_domain_installs') op.drop_index('ix_musehub_auth_challenges_expires_at', table_name='musehub_auth_challenges') op.drop_table('musehub_auth_challenges') op.drop_index('ix_musehub_attestations_subject', table_name='musehub_attestations') op.drop_index('ix_musehub_attestations_attester', table_name='musehub_attestations') op.drop_table('musehub_attestations') op.drop_table('muse_snapshots') op.drop_table('muse_objects') # ### end Alembic commands ### op.drop_index, op.drop_table = _orig_drop_index, _orig_drop_table