gabriel / musehub public
0002_add_bridge_mirrors.py python
160 lines 7.6 KB
Raw
sha256:fc04e4cae9e1774d6a21b65c45daeed0e6787eb581d13aa1b03bfe9384a34226 Merge branch 'fix/two-column-scroll-layout' into dev Human 8 days 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 13 commits
sha256:fc04e4cae9e1774d6a21b65c45daeed0e6787eb581d13aa1b03bfe9384a34226 Merge branch 'fix/two-column-scroll-layout' into dev Human 8 days ago
sha256:408916fc5973ba59c6e4eebaa80ebdcc801c0a63205651e25009d11548f79454 chore: bump version to 0.2.0.dev2 — nightly.2, matching muse Sonnet 4.6 patch 11 days ago
sha256:d035733f21ccff27735fddebfbbe0ed24565a32a22db8de5885402262671ecd2 chore: bump version to 0.2.0rc15 for musehub#113 fix release Sonnet 4.6 patch 14 days ago
sha256:0032d6cfa33bc3c8367436ad768e7dd0e339b4332153160247da8266cb5fa352 Merge branch 'task/version-tags-phase3-server' into dev Human 17 days ago
sha256:4669620efda9ff41c55bdefd1f7bfe1c239d468428744c84ead9957e5a003a53 merge: rescue snapshot-recovery hardening (c00aa21d) into d… Opus 4.8 minor 29 days ago
sha256:a59da49c4611b970fc4b6ae48678ce4943261c213a07ddbd73ce9201df869b4a fix: remove false-positive proposal_comments index drop fro… Sonnet 4.6 patch 34 days ago
sha256:0a240d6dbff234f07d98a28a4a9a68db702f3f9ff9260196f24219bdb1c0b6f3 feat: render markdown mists as HTML with heading anchor links Sonnet 4.6 patch 34 days ago
sha256:24a7d47486ebc4ebd1832830580e177ec6f877b48dced8c000e198cdec4ce9d6 Merge 'task/bump-version-rc12' into 'dev' — proposal: Bump … Human 35 days ago
sha256:b9ff931d147e0114a1f17060f415b89ed551c170a91ff226c70437aa5c85f9ee Merge 'task/bump-version-rc12' into 'dev' — proposal: Bump … Human 35 days ago
sha256:d1122d21e73471879b460037b22c0b50fded7c423444a176f248428f75dac39c Merge 'task/fix-issue-pagination-cursor' into 'dev' — propo… Human 35 days ago
sha256:01e18975e73d2b3cd5b6db7929c895bef9aa6e0d4391dc5b2adfc548b41318dd Merge 'feat/adding-debug-logs-to-staging' into 'dev' — prop… Human 36 days ago
sha256:6b1949fc2797ca4c1936a637a4cbfec828ef56cf52398a2e74ca3c4f494e728f fix: use wire_bytes not mpack_bytes_raw in compute_object_b… Sonnet 4.6 patch 48 days ago
sha256:b99f2455dc346966d040133f5203297e6e3ef5803a93728a2c30568d0a0f7583 rename: delta_add → delta_upsert across wire format, models… Sonnet 4.6 patch 50 days ago