gabriel / musehub public
0002_add_bridge_mirrors.py python
160 lines 7.6 KB
Raw
sha256:3ff9c9863a9891bdcde71b4a43228f66d0493e38b7cc1d09fe9eb7de774046b2 feat: add repair-commit wire endpoint (API parity with repa… Opus 4.8 minor ⚠ breaking 1 day ago
1 """add_musehub_bridge_mirrors
2
3 Revision ID: 0002
4 Revises: 0001
5 Create Date: 2026-04-28 15:06:37.762517+00:00
6
7 """
8 from __future__ import annotations
9
10 from typing import Sequence, Union
11
12 from alembic import op
13 import sqlalchemy as sa
14 from sqlalchemy.dialects import postgresql
15
16 # revision identifiers, used by Alembic.
17 revision: str = '0002'
18 down_revision: Union[str, None] = '0001'
19 branch_labels: Union[str, Sequence[str], None] = None
20 depends_on: Union[str, Sequence[str], None] = None
21
22
23 def upgrade() -> None:
24 # ### commands auto generated by Alembic - please adjust! ###
25 op.create_table('musehub_bridge_mirrors',
26 sa.Column('id', sa.String(length=128), nullable=False),
27 sa.Column('repo_id', sa.String(length=128), nullable=False),
28 sa.Column('git_remote_url', sa.String(length=2048), nullable=False),
29 sa.Column('git_branch', sa.String(length=255), nullable=False),
30 sa.Column('direction', sa.String(length=20), nullable=False),
31 sa.Column('last_export_muse_commit_id', sa.String(length=128), nullable=True),
32 sa.Column('last_export_git_sha', sa.String(length=128), nullable=True),
33 sa.Column('last_export_at', sa.DateTime(timezone=True), nullable=True),
34 sa.Column('last_import_git_sha', sa.String(length=128), nullable=True),
35 sa.Column('last_import_muse_commit_id', sa.String(length=128), nullable=True),
36 sa.Column('last_import_at', sa.DateTime(timezone=True), nullable=True),
37 sa.Column('auto_export', sa.Boolean(), nullable=False),
38 sa.Column('created_by', sa.String(length=255), nullable=False),
39 sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
40 sa.ForeignKeyConstraint(['repo_id'], ['musehub_repos.repo_id'], ondelete='CASCADE'),
41 sa.PrimaryKeyConstraint('id'),
42 sa.UniqueConstraint('repo_id', 'git_remote_url', name='uq_bridge_mirror_repo_url')
43 )
44 op.create_index(op.f('ix_musehub_bridge_mirrors_repo_id'), 'musehub_bridge_mirrors', ['repo_id'], unique=False)
45 op.alter_column('muse_tags', 'tag_id',
46 existing_type=sa.VARCHAR(length=128),
47 type_=sa.String(length=36),
48 existing_nullable=False)
49 op.alter_column('musehub_attestations', 'issued_at',
50 existing_type=postgresql.TIMESTAMP(timezone=True),
51 server_default=None,
52 existing_nullable=False)
53 op.alter_column('musehub_background_jobs', 'job_type',
54 existing_type=sa.VARCHAR(length=128),
55 type_=sa.String(length=64),
56 existing_nullable=False)
57 op.alter_column('musehub_coord_reservations', 'reservation_id',
58 existing_type=sa.VARCHAR(length=36),
59 type_=sa.String(length=128),
60 existing_nullable=False)
61 op.alter_column('musehub_coord_tasks', 'task_id',
62 existing_type=sa.VARCHAR(length=36),
63 type_=sa.String(length=128),
64 existing_nullable=False)
65 op.alter_column('musehub_domains', 'manifest_hash',
66 existing_type=sa.VARCHAR(length=64),
67 type_=sa.String(length=128),
68 existing_nullable=False)
69 op.alter_column('musehub_intel_results', 'data_json',
70 existing_type=sa.TEXT(),
71 server_default=None,
72 existing_nullable=False)
73 op.alter_column('musehub_intel_results', 'schema_version',
74 existing_type=sa.INTEGER(),
75 server_default=None,
76 existing_nullable=False)
77 op.alter_column('musehub_intel_results', 'computed_at',
78 existing_type=postgresql.TIMESTAMP(timezone=True),
79 server_default=None,
80 existing_nullable=False)
81 op.alter_column('musehub_mpay_claims', 'created_at',
82 existing_type=postgresql.TIMESTAMP(timezone=True),
83 server_default=None,
84 existing_nullable=False)
85 op.execute('DROP INDEX IF EXISTS ix_musehub_objects_deleted_at')
86 op.alter_column('musehub_profile_snapshots', 'data_json',
87 existing_type=sa.TEXT(),
88 server_default=None,
89 existing_nullable=False)
90 op.alter_column('musehub_profile_snapshots', 'computed_at',
91 existing_type=postgresql.TIMESTAMP(timezone=True),
92 server_default=None,
93 existing_nullable=False)
94 op.alter_column('musehub_profile_snapshots', 'is_stale',
95 existing_type=sa.BOOLEAN(),
96 server_default=None,
97 existing_nullable=False)
98 op.execute('DROP INDEX IF EXISTS ix_musehub_profile_snapshots_computed_at')
99 # ### end Alembic commands ###
100
101
102 def downgrade() -> None:
103 # ### commands auto generated by Alembic - please adjust! ###
104 op.create_index(op.f('ix_musehub_profile_snapshots_computed_at'), 'musehub_profile_snapshots', ['computed_at'], unique=False)
105 op.alter_column('musehub_profile_snapshots', 'is_stale',
106 existing_type=sa.BOOLEAN(),
107 server_default=sa.text('false'),
108 existing_nullable=False)
109 op.alter_column('musehub_profile_snapshots', 'computed_at',
110 existing_type=postgresql.TIMESTAMP(timezone=True),
111 server_default=sa.text('now()'),
112 existing_nullable=False)
113 op.alter_column('musehub_profile_snapshots', 'data_json',
114 existing_type=sa.TEXT(),
115 server_default=sa.text("'{}'::text"),
116 existing_nullable=False)
117 op.create_index(op.f('ix_musehub_objects_deleted_at'), 'musehub_objects', ['deleted_at'], unique=False)
118 op.alter_column('musehub_mpay_claims', 'created_at',
119 existing_type=postgresql.TIMESTAMP(timezone=True),
120 server_default=sa.text('CURRENT_TIMESTAMP'),
121 existing_nullable=False)
122 op.alter_column('musehub_intel_results', 'computed_at',
123 existing_type=postgresql.TIMESTAMP(timezone=True),
124 server_default=sa.text('now()'),
125 existing_nullable=False)
126 op.alter_column('musehub_intel_results', 'schema_version',
127 existing_type=sa.INTEGER(),
128 server_default=sa.text('1'),
129 existing_nullable=False)
130 op.alter_column('musehub_intel_results', 'data_json',
131 existing_type=sa.TEXT(),
132 server_default=sa.text("'{}'::text"),
133 existing_nullable=False)
134 op.alter_column('musehub_domains', 'manifest_hash',
135 existing_type=sa.String(length=128),
136 type_=sa.VARCHAR(length=64),
137 existing_nullable=False)
138 op.alter_column('musehub_coord_tasks', 'task_id',
139 existing_type=sa.String(length=128),
140 type_=sa.VARCHAR(length=36),
141 existing_nullable=False)
142 op.alter_column('musehub_coord_reservations', 'reservation_id',
143 existing_type=sa.String(length=128),
144 type_=sa.VARCHAR(length=36),
145 existing_nullable=False)
146 op.alter_column('musehub_background_jobs', 'job_type',
147 existing_type=sa.String(length=64),
148 type_=sa.VARCHAR(length=128),
149 existing_nullable=False)
150 op.alter_column('musehub_attestations', 'issued_at',
151 existing_type=postgresql.TIMESTAMP(timezone=True),
152 server_default=sa.text('CURRENT_TIMESTAMP'),
153 existing_nullable=False)
154 op.alter_column('muse_tags', 'tag_id',
155 existing_type=sa.String(length=36),
156 type_=sa.VARCHAR(length=128),
157 existing_nullable=False)
158 op.drop_index(op.f('ix_musehub_bridge_mirrors_repo_id'), table_name='musehub_bridge_mirrors')
159 op.drop_table('musehub_bridge_mirrors')
160 # ### end Alembic commands ###
File History 1 commit
sha256:3ff9c9863a9891bdcde71b4a43228f66d0493e38b7cc1d09fe9eb7de774046b2 feat: add repair-commit wire endpoint (API parity with repa… Opus 4.8 minor 1 day ago