Skip to content

Commit 371d69e

Browse files
committed
add migrations to vcs
1 parent ca35f62 commit 371d69e

30 files changed

+1827
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""empty message
2+
3+
Revision ID: 0717f5de725b
4+
Revises: c1fb13263539
5+
Create Date: 2023-12-12 22:59:12.319399
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
import sqlalchemy_utils
11+
12+
13+
# revision identifiers, used by Alembic.
14+
revision = '0717f5de725b'
15+
down_revision = 'c1fb13263539'
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.add_column('specification_conditions', sa.Column('user_id', sa.Text(), nullable=True))
23+
op.create_foreign_key(None, 'specification_conditions', 'users', ['user_id'], ['external_id'])
24+
op.add_column('specifications', sa.Column('database_studyset', sa.Text(), nullable=True))
25+
# ### end Alembic commands ###
26+
27+
28+
def downgrade():
29+
# ### commands auto generated by Alembic - please adjust! ###
30+
op.drop_column('specifications', 'database_studyset')
31+
op.drop_constraint(None, 'specification_conditions', type_='foreignkey')
32+
op.drop_column('specification_conditions', 'user_id')
33+
# ### end Alembic commands ###
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""empty message
2+
3+
Revision ID: 164fb969f549
4+
Revises: e1c296d89bf1
5+
Create Date: 2023-05-18 19:15:07.407065
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
import sqlalchemy_utils
11+
12+
13+
# revision identifiers, used by Alembic.
14+
revision = '164fb969f549'
15+
down_revision = 'e1c296d89bf1'
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.add_column('meta_analysis_results', sa.Column('diagnostic_table', sa.Text(), nullable=True))
23+
# ### end Alembic commands ###
24+
25+
26+
def downgrade():
27+
# ### commands auto generated by Alembic - please adjust! ###
28+
op.drop_column('meta_analysis_results', 'diagnostic_table')
29+
# ### end Alembic commands ###
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
"""empty message
2+
3+
Revision ID: 26aa47ee8e3e
4+
Revises: 76c16b00a2bc
5+
Create Date: 2022-12-16 18:22:04.536097
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
import sqlalchemy_utils
11+
12+
13+
# revision identifiers, used by Alembic.
14+
revision = '26aa47ee8e3e'
15+
down_revision = '76c16b00a2bc'
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.create_table('projects',
23+
sa.Column('id', sa.Text(), nullable=False),
24+
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
25+
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
26+
sa.Column('name', sa.Text(), nullable=True),
27+
sa.Column('description', sa.Text(), nullable=True),
28+
sa.Column('provenance', sa.JSON(), nullable=True),
29+
sa.Column('user_id', sa.Text(), nullable=True),
30+
sa.ForeignKeyConstraint(['user_id'], ['users.external_id'], ),
31+
sa.PrimaryKeyConstraint('id')
32+
)
33+
op.add_column('meta_analyses', sa.Column('project_id', sa.Text(), nullable=True))
34+
op.add_column('meta_analyses', sa.Column('provenance', sa.JSON(), nullable=True))
35+
op.create_foreign_key(None, 'meta_analyses', 'projects', ['project_id'], ['id'])
36+
# ### end Alembic commands ###
37+
38+
39+
def downgrade():
40+
# ### commands auto generated by Alembic - please adjust! ###
41+
op.drop_constraint(None, 'meta_analyses', type_='foreignkey')
42+
op.drop_column('meta_analyses', 'provenance')
43+
op.drop_column('meta_analyses', 'project_id')
44+
op.drop_table('projects')
45+
# ### end Alembic commands ###
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""empty message
2+
3+
Revision ID: 28251f5cb6d5
4+
Revises: 3d0fc483f06b
5+
Create Date: 2025-10-13 19:11:58.785877
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
import sqlalchemy_utils
11+
12+
13+
# revision identifiers, used by Alembic.
14+
revision = '28251f5cb6d5'
15+
down_revision = '3d0fc483f06b'
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
with op.batch_alter_table('projects', schema=None) as batch_op:
23+
batch_op.add_column(sa.Column('studyset_id', sa.Text(), nullable=True))
24+
batch_op.add_column(sa.Column('annotation_id', sa.Text(), nullable=True))
25+
batch_op.create_foreign_key(None, 'annotations', ['annotation_id'], ['id'])
26+
batch_op.create_foreign_key(None, 'studysets', ['studyset_id'], ['id'])
27+
28+
# ### end Alembic commands ###
29+
30+
31+
def downgrade():
32+
# ### commands auto generated by Alembic - please adjust! ###
33+
with op.batch_alter_table('projects', schema=None) as batch_op:
34+
batch_op.drop_constraint(None, type_='foreignkey')
35+
batch_op.drop_constraint(None, type_='foreignkey')
36+
batch_op.drop_column('annotation_id')
37+
batch_op.drop_column('studyset_id')
38+
39+
# ### end Alembic commands ###
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""empty message
2+
3+
Revision ID: 3d0fc483f06b
4+
Revises: 52eabbbdffe6
5+
Create Date: 2025-08-21 22:16:48.621497
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
import sqlalchemy_utils
11+
12+
13+
# revision identifiers, used by Alembic.
14+
revision = '3d0fc483f06b'
15+
down_revision = '52eabbbdffe6'
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.create_index(op.f('ix_projects_draft'), 'projects', ['draft'], unique=False)
23+
op.create_index(op.f('ix_projects_public'), 'projects', ['public'], unique=False)
24+
op.create_index(op.f('ix_projects_user_id'), 'projects', ['user_id'], unique=False)
25+
# ### end Alembic commands ###
26+
27+
28+
def downgrade():
29+
# ### commands auto generated by Alembic - please adjust! ###
30+
op.drop_index(op.f('ix_projects_user_id'), table_name='projects')
31+
op.drop_index(op.f('ix_projects_public'), table_name='projects')
32+
op.drop_index(op.f('ix_projects_draft'), table_name='projects')
33+
# ### end Alembic commands ###
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""empty message
2+
3+
Revision ID: 49a5cb9f13f2
4+
Revises: 6297073f6fcd
5+
Create Date: 2023-10-04 16:33:06.160009
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
import sqlalchemy_utils
11+
12+
13+
# revision identifiers, used by Alembic.
14+
revision = '49a5cb9f13f2'
15+
down_revision = '6297073f6fcd'
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.add_column('specifications', sa.Column('contrast', sa.JSON(), nullable=True))
23+
# ### end Alembic commands ###
24+
25+
26+
def downgrade():
27+
# ### commands auto generated by Alembic - please adjust! ###
28+
op.drop_column('specifications', 'contrast')
29+
# ### end Alembic commands ###
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""empty message
2+
3+
Revision ID: 52eabbbdffe6
4+
Revises: 0717f5de725b
5+
Create Date: 2024-06-15 16:44:18.644557
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
import sqlalchemy_utils
11+
12+
13+
# revision identifiers, used by Alembic.
14+
revision = '52eabbbdffe6'
15+
down_revision = '0717f5de725b'
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.add_column('projects', sa.Column('draft', sa.Boolean(), nullable=True))
23+
# ### end Alembic commands ###
24+
25+
26+
def downgrade():
27+
# ### commands auto generated by Alembic - please adjust! ###
28+
op.drop_column('projects', 'draft')
29+
# ### end Alembic commands ###
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
"""empty message
2+
3+
Revision ID: 6297073f6fcd
4+
Revises: 164fb969f549
5+
Create Date: 2023-10-04 13:36:36.588979
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
import sqlalchemy_utils
11+
from sqlalchemy.dialects import postgresql
12+
13+
# revision identifiers, used by Alembic.
14+
revision = '6297073f6fcd'
15+
down_revision = '164fb969f549'
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.create_table('conditions',
23+
sa.Column('id', sa.Text(), nullable=False),
24+
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
25+
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
26+
sa.Column('name', sa.Text(), nullable=True),
27+
sa.Column('description', sa.Text(), nullable=True),
28+
sa.PrimaryKeyConstraint('id')
29+
)
30+
op.create_table('specification_conditions',
31+
sa.Column('id', sa.Text(), nullable=False),
32+
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
33+
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
34+
sa.Column('weight', sa.Float(), nullable=True),
35+
sa.Column('specification_id', sa.Text(), nullable=False),
36+
sa.Column('condition_id', sa.Text(), nullable=False),
37+
sa.ForeignKeyConstraint(['condition_id'], ['conditions.id'], ),
38+
sa.ForeignKeyConstraint(['specification_id'], ['specifications.id'], ),
39+
sa.PrimaryKeyConstraint('id', 'specification_id', 'condition_id')
40+
)
41+
op.create_index(op.f('ix_specification_conditions_condition_id'), 'specification_conditions', ['condition_id'], unique=False)
42+
op.create_index(op.f('ix_specification_conditions_specification_id'), 'specification_conditions', ['specification_id'], unique=False)
43+
op.drop_column('specifications', 'contrast')
44+
op.add_column('studyset_references', sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True))
45+
op.add_column('studyset_references', sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True))
46+
op.add_column('studysets', sa.Column('version', sa.Text(), nullable=True))
47+
# ### end Alembic commands ###
48+
49+
50+
def downgrade():
51+
# ### commands auto generated by Alembic - please adjust! ###
52+
op.drop_column('studysets', 'version')
53+
op.drop_column('studyset_references', 'updated_at')
54+
op.drop_column('studyset_references', 'created_at')
55+
op.add_column('specifications', sa.Column('contrast', postgresql.JSON(astext_type=sa.Text()), autoincrement=False, nullable=True))
56+
op.drop_index(op.f('ix_specification_conditions_specification_id'), table_name='specification_conditions')
57+
op.drop_index(op.f('ix_specification_conditions_condition_id'), table_name='specification_conditions')
58+
op.drop_table('specification_conditions')
59+
op.drop_table('conditions')
60+
# ### end Alembic commands ###
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
"""empty message
2+
3+
Revision ID: 685f12e01296
4+
Revises: 26aa47ee8e3e
5+
Create Date: 2023-02-16 17:31:51.608961
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
import sqlalchemy_utils
11+
12+
13+
# revision identifiers, used by Alembic.
14+
revision = '685f12e01296'
15+
down_revision = '26aa47ee8e3e'
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.create_table('meta_analysis_results',
23+
sa.Column('id', sa.Text(), nullable=False),
24+
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
25+
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
26+
sa.Column('meta_analysis_id', sa.Text(), nullable=True),
27+
sa.Column('neurostore_id', sa.Text(), nullable=True),
28+
sa.Column('cli_version', sa.Text(), nullable=True),
29+
sa.Column('cli_args', sa.JSON(), nullable=True),
30+
sa.ForeignKeyConstraint(['meta_analysis_id'], ['meta_analyses.id'], ),
31+
sa.PrimaryKeyConstraint('id'),
32+
sa.UniqueConstraint('neurostore_id')
33+
)
34+
op.create_table('neurovault_collections',
35+
sa.Column('id', sa.Text(), nullable=False),
36+
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
37+
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
38+
sa.Column('collection_id', sa.Integer(), nullable=True),
39+
sa.Column('result_id', sa.Text(), nullable=True),
40+
sa.ForeignKeyConstraint(['result_id'], ['meta_analysis_results.id'], ),
41+
sa.PrimaryKeyConstraint('id'),
42+
sa.UniqueConstraint('collection_id'),
43+
sa.UniqueConstraint('result_id')
44+
)
45+
op.create_table('neurovault_file',
46+
sa.Column('id', sa.Text(), nullable=False),
47+
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
48+
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
49+
sa.Column('collection_id', sa.Integer(), nullable=False),
50+
sa.Column('image_id', sa.Integer(), nullable=True),
51+
sa.Column('exception', sa.Text(), nullable=True),
52+
sa.Column('traceback', sa.Text(), nullable=True),
53+
sa.Column('status', sa.Text(), nullable=True),
54+
sa.CheckConstraint("status IN ('OK', 'FAILED', 'PENDING')"),
55+
sa.ForeignKeyConstraint(['collection_id'], ['neurovault_collections.collection_id'], ),
56+
sa.PrimaryKeyConstraint('id'),
57+
sa.UniqueConstraint('image_id')
58+
)
59+
# ### end Alembic commands ###
60+
61+
62+
def downgrade():
63+
# ### commands auto generated by Alembic - please adjust! ###
64+
op.drop_table('neurovault_file')
65+
op.drop_table('neurovault_collections')
66+
op.drop_table('meta_analysis_results')
67+
# ### end Alembic commands ###

0 commit comments

Comments
 (0)