diff --git a/apiv2/database/migrations/versions/20241213_131118_autogenerated.py b/apiv2/database/migrations/versions/20241213_131118_autogenerated.py index 299fc6dab..7516b6ed6 100644 --- a/apiv2/database/migrations/versions/20241213_131118_autogenerated.py +++ b/apiv2/database/migrations/versions/20241213_131118_autogenerated.py @@ -3,27 +3,28 @@ Create Date: 2024-12-13 18:11:22.094904 """ + import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. -revision = '20241213_131118' -down_revision = '20241010_153240' +revision = "20241213_131118" +down_revision = "20241010_153240" branch_labels = None depends_on = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.add_column('tiltseries', sa.Column('size_x', sa.Integer(), nullable=True)) - op.add_column('tiltseries', sa.Column('size_y', sa.Integer(), nullable=True)) - op.add_column('tiltseries', sa.Column('size_z', sa.Integer(), nullable=True)) + op.add_column("tiltseries", sa.Column("size_x", sa.Integer(), nullable=True)) + op.add_column("tiltseries", sa.Column("size_y", sa.Integer(), nullable=True)) + op.add_column("tiltseries", sa.Column("size_z", sa.Integer(), nullable=True)) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.drop_column('tiltseries', 'size_z') - op.drop_column('tiltseries', 'size_y') - op.drop_column('tiltseries', 'size_x') + op.drop_column("tiltseries", "size_z") + op.drop_column("tiltseries", "size_y") + op.drop_column("tiltseries", "size_x") # ### end Alembic commands ### diff --git a/apiv2/database/migrations/versions/20250109_114311_autogenerated.py b/apiv2/database/migrations/versions/20250109_114311_autogenerated.py index ea8746c14..15c9fffa2 100644 --- a/apiv2/database/migrations/versions/20250109_114311_autogenerated.py +++ b/apiv2/database/migrations/versions/20250109_114311_autogenerated.py @@ -3,35 +3,36 @@ Create Date: 2025-01-09 16:43:14.268438 """ + import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. -revision = '20250109_114311' -down_revision = '20241213_131118' +revision = "20250109_114311" +down_revision = "20241213_131118" branch_labels = None depends_on = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.add_column('annotation_file', sa.Column('file_size', sa.Integer(), nullable=True)) - op.add_column('dataset', sa.Column('file_size', sa.Integer(), nullable=True)) - op.add_column('frame', sa.Column('file_size', sa.Integer(), nullable=True)) - op.add_column('tiltseries', sa.Column('file_size_omezarr', sa.Integer(), nullable=True)) - op.add_column('tiltseries', sa.Column('file_size_mrc', sa.Integer(), nullable=True)) - op.add_column('tomogram', sa.Column('file_size_omezarr', sa.Integer(), nullable=True)) - op.add_column('tomogram', sa.Column('file_size_mrc', sa.Integer(), nullable=True)) + op.add_column("annotation_file", sa.Column("file_size", sa.Integer(), nullable=True)) + op.add_column("dataset", sa.Column("file_size", sa.Integer(), nullable=True)) + op.add_column("frame", sa.Column("file_size", sa.Integer(), nullable=True)) + op.add_column("tiltseries", sa.Column("file_size_omezarr", sa.Integer(), nullable=True)) + op.add_column("tiltseries", sa.Column("file_size_mrc", sa.Integer(), nullable=True)) + op.add_column("tomogram", sa.Column("file_size_omezarr", sa.Integer(), nullable=True)) + op.add_column("tomogram", sa.Column("file_size_mrc", sa.Integer(), nullable=True)) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.drop_column('tomogram', 'file_size_mrc') - op.drop_column('tomogram', 'file_size_omezarr') - op.drop_column('tiltseries', 'file_size_mrc') - op.drop_column('tiltseries', 'file_size_omezarr') - op.drop_column('frame', 'file_size') - op.drop_column('dataset', 'file_size') - op.drop_column('annotation_file', 'file_size') + op.drop_column("tomogram", "file_size_mrc") + op.drop_column("tomogram", "file_size_omezarr") + op.drop_column("tiltseries", "file_size_mrc") + op.drop_column("tiltseries", "file_size_omezarr") + op.drop_column("frame", "file_size") + op.drop_column("dataset", "file_size") + op.drop_column("annotation_file", "file_size") # ### end Alembic commands ### diff --git a/apiv2/database/migrations/versions/20250110_181130_autogenerated.py b/apiv2/database/migrations/versions/20250110_181130_autogenerated.py new file mode 100644 index 000000000..9f0470e99 --- /dev/null +++ b/apiv2/database/migrations/versions/20250110_181130_autogenerated.py @@ -0,0 +1,701 @@ +"""autogenerated + +Create Date: 2025-01-10 23:11:33.018478 + +""" +import sqlalchemy as sa +from alembic import op + +# revision identifiers, used by Alembic. +revision = '20250110_181130' +down_revision = '20250109_114311' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column('alignment', 'deposition_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('alignment', 'tiltseries_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('alignment', 'run_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('alignment', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True, + existing_server_default=sa.text("nextval('alignment_id_seq'::regclass)")) + op.alter_column('annotation', 'run_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('annotation', 'deposition_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('annotation', 'object_count', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('annotation', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('annotation_author', 'annotation_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('annotation_author', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('annotation_author', 'author_list_order', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('annotation_file', 'alignment_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('annotation_file', 'annotation_shape_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('annotation_file', 'tomogram_voxel_spacing_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('annotation_file', 'file_size', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('annotation_file', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('annotation_method_link', 'annotation_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('annotation_method_link', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('annotation_shape', 'annotation_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('annotation_shape', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('dataset', 'deposition_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('dataset', 'organism_taxid', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('dataset', 'file_size', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('dataset', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('dataset_author', 'dataset_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('dataset_author', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('dataset_author', 'author_list_order', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('dataset_funding', 'dataset_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('dataset_funding', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('deposition', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True, + existing_server_default=sa.text("nextval('deposition_id_seq'::regclass)")) + op.alter_column('deposition_author', 'deposition_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('deposition_author', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('deposition_author', 'author_list_order', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('deposition_type', 'deposition_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('deposition_type', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('frame', 'deposition_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('frame', 'run_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('frame', 'acquisition_order', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('frame', 'file_size', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('frame', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('frame_acquisition_file', 'run_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('frame_acquisition_file', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('gain_file', 'run_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('gain_file', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('per_section_alignment_parameters', 'alignment_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('per_section_alignment_parameters', 'z_index', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('per_section_alignment_parameters', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('run', 'dataset_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('run', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True, + existing_server_default=sa.text("nextval('run_id_seq'::regclass)")) + op.alter_column('tiltseries', 'run_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('tiltseries', 'deposition_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('tiltseries', 'file_size_omezarr', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('tiltseries', 'file_size_mrc', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('tiltseries', 'acceleration_voltage', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('tiltseries', 'tilt_series_quality', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('tiltseries', 'aligned_tiltseries_binning', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('tiltseries', 'size_x', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('tiltseries', 'size_y', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('tiltseries', 'size_z', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('tiltseries', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True, + existing_server_default=sa.text("nextval('tiltseries_id_seq'::regclass)")) + op.alter_column('tomogram', 'alignment_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('tomogram', 'deposition_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('tomogram', 'run_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('tomogram', 'tomogram_voxel_spacing_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('tomogram', 'size_x', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('tomogram', 'size_y', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('tomogram', 'size_z', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('tomogram', 'file_size_omezarr', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('tomogram', 'file_size_mrc', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('tomogram', 'offset_x', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('tomogram', 'offset_y', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('tomogram', 'offset_z', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('tomogram', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True, + existing_server_default=sa.text("nextval('tomogram_id_seq'::regclass)")) + op.alter_column('tomogram_author', 'tomogram_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('tomogram_author', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True) + op.alter_column('tomogram_author', 'author_list_order', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False) + op.alter_column('tomogram_voxel_spacing', 'run_id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=True) + op.alter_column('tomogram_voxel_spacing', 'id', + existing_type=sa.INTEGER(), + type_=sa.BigInteger(), + existing_nullable=False, + autoincrement=True, + existing_server_default=sa.text("nextval('tomogram_voxel_spacing_id_seq'::regclass)")) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column('tomogram_voxel_spacing', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True, + existing_server_default=sa.text("nextval('tomogram_voxel_spacing_id_seq'::regclass)")) + op.alter_column('tomogram_voxel_spacing', 'run_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('tomogram_author', 'author_list_order', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('tomogram_author', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('tomogram_author', 'tomogram_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('tomogram', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True, + existing_server_default=sa.text("nextval('tomogram_id_seq'::regclass)")) + op.alter_column('tomogram', 'offset_z', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('tomogram', 'offset_y', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('tomogram', 'offset_x', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('tomogram', 'file_size_mrc', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('tomogram', 'file_size_omezarr', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('tomogram', 'size_z', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('tomogram', 'size_y', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('tomogram', 'size_x', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('tomogram', 'tomogram_voxel_spacing_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('tomogram', 'run_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('tomogram', 'deposition_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('tomogram', 'alignment_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('tiltseries', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True, + existing_server_default=sa.text("nextval('tiltseries_id_seq'::regclass)")) + op.alter_column('tiltseries', 'size_z', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('tiltseries', 'size_y', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('tiltseries', 'size_x', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('tiltseries', 'aligned_tiltseries_binning', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('tiltseries', 'tilt_series_quality', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('tiltseries', 'acceleration_voltage', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('tiltseries', 'file_size_mrc', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('tiltseries', 'file_size_omezarr', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('tiltseries', 'deposition_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('tiltseries', 'run_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('run', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True, + existing_server_default=sa.text("nextval('run_id_seq'::regclass)")) + op.alter_column('run', 'dataset_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('per_section_alignment_parameters', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('per_section_alignment_parameters', 'z_index', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('per_section_alignment_parameters', 'alignment_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('gain_file', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('gain_file', 'run_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('frame_acquisition_file', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('frame_acquisition_file', 'run_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('frame', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('frame', 'file_size', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('frame', 'acquisition_order', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('frame', 'run_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('frame', 'deposition_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('deposition_type', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('deposition_type', 'deposition_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('deposition_author', 'author_list_order', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('deposition_author', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('deposition_author', 'deposition_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('deposition', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True, + existing_server_default=sa.text("nextval('deposition_id_seq'::regclass)")) + op.alter_column('dataset_funding', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('dataset_funding', 'dataset_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('dataset_author', 'author_list_order', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('dataset_author', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('dataset_author', 'dataset_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('dataset', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('dataset', 'file_size', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('dataset', 'organism_taxid', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('dataset', 'deposition_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('annotation_shape', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('annotation_shape', 'annotation_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('annotation_method_link', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('annotation_method_link', 'annotation_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('annotation_file', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('annotation_file', 'file_size', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('annotation_file', 'tomogram_voxel_spacing_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('annotation_file', 'annotation_shape_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('annotation_file', 'alignment_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('annotation_author', 'author_list_order', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False) + op.alter_column('annotation_author', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('annotation_author', 'annotation_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('annotation', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True) + op.alter_column('annotation', 'object_count', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('annotation', 'deposition_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('annotation', 'run_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('alignment', 'id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=False, + autoincrement=True, + existing_server_default=sa.text("nextval('alignment_id_seq'::regclass)")) + op.alter_column('alignment', 'run_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('alignment', 'tiltseries_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + op.alter_column('alignment', 'deposition_id', + existing_type=sa.BigInteger(), + type_=sa.INTEGER(), + existing_nullable=True) + # ### end Alembic commands ### diff --git a/apiv2/database/models/alignment.py b/apiv2/database/models/alignment.py index a6e722c75..6dbe4a7ab 100644 --- a/apiv2/database/models/alignment.py +++ b/apiv2/database/models/alignment.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import Boolean, Enum, Float, ForeignKey, Integer, String +from sqlalchemy import BigInteger, Boolean, Enum, Float, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from support.enums import alignment_method_type_enum, alignment_type_enum @@ -54,13 +54,13 @@ class Alignment(Base): foreign_keys="PerSectionAlignmentParameters.alignment_id", cascade="all, delete-orphan", ) - deposition_id: Mapped[int] = mapped_column(Integer, ForeignKey("deposition.id"), nullable=True, index=True) + deposition_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("deposition.id"), nullable=True, index=True) deposition: Mapped["Deposition"] = relationship( "Deposition", foreign_keys=deposition_id, back_populates="alignments", ) - tiltseries_id: Mapped[int] = mapped_column(Integer, ForeignKey("tiltseries.id"), nullable=True, index=True) + tiltseries_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("tiltseries.id"), nullable=True, index=True) tiltseries: Mapped["Tiltseries"] = relationship( "Tiltseries", foreign_keys=tiltseries_id, @@ -73,7 +73,7 @@ class Alignment(Base): foreign_keys="Tomogram.alignment_id", cascade="all, delete-orphan", ) - run_id: Mapped[int] = mapped_column(Integer, ForeignKey("run.id"), nullable=True, index=True) + run_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("run.id"), nullable=True, index=True) run: Mapped["Run"] = relationship( "Run", foreign_keys=run_id, @@ -97,4 +97,4 @@ class Alignment(Base): s3_alignment_metadata: Mapped[str] = mapped_column(String, nullable=True) https_alignment_metadata: Mapped[str] = mapped_column(String, nullable=True) is_portal_standard: Mapped[bool] = mapped_column(Boolean, nullable=True) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/database/models/annotation.py b/apiv2/database/models/annotation.py index 60ce1a4c0..b3aab7abf 100644 --- a/apiv2/database/models/annotation.py +++ b/apiv2/database/models/annotation.py @@ -8,7 +8,7 @@ import datetime from typing import TYPE_CHECKING -from sqlalchemy import Boolean, DateTime, Enum, Float, ForeignKey, Integer, String +from sqlalchemy import BigInteger, Boolean, DateTime, Enum, Float, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from support.enums import annotation_method_type_enum @@ -39,7 +39,7 @@ class Annotation(Base): __tablename__ = "annotation" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - run_id: Mapped[int] = mapped_column(Integer, ForeignKey("run.id"), nullable=True, index=True) + run_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("run.id"), nullable=True, index=True) run: Mapped["Run"] = relationship( "Run", foreign_keys=run_id, @@ -66,7 +66,7 @@ class Annotation(Base): foreign_keys="AnnotationAuthor.annotation_id", cascade="all, delete-orphan", ) - deposition_id: Mapped[int] = mapped_column(Integer, ForeignKey("deposition.id"), nullable=True, index=True) + deposition_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("deposition.id"), nullable=True, index=True) deposition: Mapped["Deposition"] = relationship( "Deposition", foreign_keys=deposition_id, @@ -81,7 +81,7 @@ class Annotation(Base): object_name: Mapped[str] = mapped_column(String, nullable=False) object_description: Mapped[str] = mapped_column(String, nullable=True) object_state: Mapped[str] = mapped_column(String, nullable=True) - object_count: Mapped[int] = mapped_column(Integer, nullable=True) + object_count: Mapped[int] = mapped_column(BigInteger, nullable=True) confidence_precision: Mapped[float] = mapped_column(Float, nullable=True) confidence_recall: Mapped[float] = mapped_column(Float, nullable=True) ground_truth_used: Mapped[str] = mapped_column(String, nullable=True) @@ -93,4 +93,4 @@ class Annotation(Base): deposition_date: Mapped[datetime.datetime] = mapped_column(DateTime(timezone=True), nullable=False) release_date: Mapped[datetime.datetime] = mapped_column(DateTime(timezone=True), nullable=False) last_modified_date: Mapped[datetime.datetime] = mapped_column(DateTime(timezone=True), nullable=False) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/database/models/annotation_author.py b/apiv2/database/models/annotation_author.py index 0eee45d9b..fbf5f1d7a 100644 --- a/apiv2/database/models/annotation_author.py +++ b/apiv2/database/models/annotation_author.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import Boolean, ForeignKey, Integer, String +from sqlalchemy import BigInteger, Boolean, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from platformics.database.models.base import Base @@ -29,14 +29,14 @@ class AnnotationAuthor(Base): __tablename__ = "annotation_author" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - annotation_id: Mapped[int] = mapped_column(Integer, ForeignKey("annotation.id"), nullable=True, index=True) + annotation_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("annotation.id"), nullable=True, index=True) annotation: Mapped["Annotation"] = relationship( "Annotation", foreign_keys=annotation_id, back_populates="authors", ) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) - author_list_order: Mapped[int] = mapped_column(Integer, nullable=False) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) + author_list_order: Mapped[int] = mapped_column(BigInteger, nullable=False) orcid: Mapped[str] = mapped_column(String, nullable=True) name: Mapped[str] = mapped_column(String, nullable=False) email: Mapped[str] = mapped_column(String, nullable=True) diff --git a/apiv2/database/models/annotation_file.py b/apiv2/database/models/annotation_file.py index dd8f808e0..46424e118 100644 --- a/apiv2/database/models/annotation_file.py +++ b/apiv2/database/models/annotation_file.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import Boolean, Enum, ForeignKey, Integer, String +from sqlalchemy import BigInteger, Boolean, Enum, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from support.enums import annotation_file_source_enum @@ -34,14 +34,14 @@ class AnnotationFile(Base): __tablename__ = "annotation_file" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - alignment_id: Mapped[int] = mapped_column(Integer, ForeignKey("alignment.id"), nullable=True, index=True) + alignment_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("alignment.id"), nullable=True, index=True) alignment: Mapped["Alignment"] = relationship( "Alignment", foreign_keys=alignment_id, back_populates="annotation_files", ) annotation_shape_id: Mapped[int] = mapped_column( - Integer, ForeignKey("annotation_shape.id"), nullable=True, index=True, + BigInteger, ForeignKey("annotation_shape.id"), nullable=True, index=True, ) annotation_shape: Mapped["AnnotationShape"] = relationship( "AnnotationShape", @@ -49,7 +49,7 @@ class AnnotationFile(Base): back_populates="annotation_files", ) tomogram_voxel_spacing_id: Mapped[int] = mapped_column( - Integer, ForeignKey("tomogram_voxel_spacing.id"), nullable=True, index=True, + BigInteger, ForeignKey("tomogram_voxel_spacing.id"), nullable=True, index=True, ) tomogram_voxel_spacing: Mapped["TomogramVoxelSpacing"] = relationship( "TomogramVoxelSpacing", @@ -58,10 +58,10 @@ class AnnotationFile(Base): ) format: Mapped[str] = mapped_column(String, nullable=False) s3_path: Mapped[str] = mapped_column(String, nullable=False) - file_size: Mapped[int] = mapped_column(Integer, nullable=True) + file_size: Mapped[int] = mapped_column(BigInteger, nullable=True) https_path: Mapped[str] = mapped_column(String, nullable=False) is_visualization_default: Mapped[bool] = mapped_column(Boolean, nullable=True) source: Mapped[annotation_file_source_enum] = mapped_column( Enum(annotation_file_source_enum, native_enum=False), nullable=True, ) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/database/models/annotation_method_link.py b/apiv2/database/models/annotation_method_link.py index 904600bb7..2bbfeffb7 100644 --- a/apiv2/database/models/annotation_method_link.py +++ b/apiv2/database/models/annotation_method_link.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import Enum, ForeignKey, Integer, String +from sqlalchemy import BigInteger, Enum, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from support.enums import annotation_method_link_type_enum @@ -30,7 +30,7 @@ class AnnotationMethodLink(Base): __tablename__ = "annotation_method_link" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - annotation_id: Mapped[int] = mapped_column(Integer, ForeignKey("annotation.id"), nullable=True, index=True) + annotation_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("annotation.id"), nullable=True, index=True) annotation: Mapped["Annotation"] = relationship( "Annotation", foreign_keys=annotation_id, @@ -41,4 +41,4 @@ class AnnotationMethodLink(Base): ) name: Mapped[str] = mapped_column(String, nullable=True) link: Mapped[str] = mapped_column(String, nullable=False) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/database/models/annotation_shape.py b/apiv2/database/models/annotation_shape.py index 4b0bba426..4e6228513 100644 --- a/apiv2/database/models/annotation_shape.py +++ b/apiv2/database/models/annotation_shape.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import Enum, ForeignKey, Integer +from sqlalchemy import BigInteger, Enum, ForeignKey from sqlalchemy.orm import Mapped, mapped_column, relationship from support.enums import annotation_file_shape_type_enum @@ -32,7 +32,7 @@ class AnnotationShape(Base): __tablename__ = "annotation_shape" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - annotation_id: Mapped[int] = mapped_column(Integer, ForeignKey("annotation.id"), nullable=True, index=True) + annotation_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("annotation.id"), nullable=True, index=True) annotation: Mapped["Annotation"] = relationship( "Annotation", foreign_keys=annotation_id, @@ -48,4 +48,4 @@ class AnnotationShape(Base): shape_type: Mapped[annotation_file_shape_type_enum] = mapped_column( Enum(annotation_file_shape_type_enum, native_enum=False), nullable=True, ) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/database/models/dataset.py b/apiv2/database/models/dataset.py index 5d8a27844..258df245b 100644 --- a/apiv2/database/models/dataset.py +++ b/apiv2/database/models/dataset.py @@ -8,7 +8,7 @@ import datetime from typing import TYPE_CHECKING -from sqlalchemy import DateTime, Enum, ForeignKey, Integer, String +from sqlalchemy import BigInteger, DateTime, Enum, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from support.enums import sample_type_enum @@ -37,7 +37,7 @@ class Dataset(Base): __tablename__ = "dataset" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - deposition_id: Mapped[int] = mapped_column(Integer, ForeignKey("deposition.id"), nullable=False, index=True) + deposition_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("deposition.id"), nullable=False, index=True) deposition: Mapped["Deposition"] = relationship( "Deposition", foreign_keys=deposition_id, @@ -63,7 +63,7 @@ class Dataset(Base): title: Mapped[str] = mapped_column(String, nullable=False) description: Mapped[str] = mapped_column(String, nullable=False) organism_name: Mapped[str] = mapped_column(String, nullable=True) - organism_taxid: Mapped[int] = mapped_column(Integer, nullable=True) + organism_taxid: Mapped[int] = mapped_column(BigInteger, nullable=True) tissue_name: Mapped[str] = mapped_column(String, nullable=True) tissue_id: Mapped[str] = mapped_column(String, nullable=True) cell_name: Mapped[str] = mapped_column(String, nullable=True) @@ -85,5 +85,5 @@ class Dataset(Base): related_database_entries: Mapped[str] = mapped_column(String, nullable=True) s3_prefix: Mapped[str] = mapped_column(String, nullable=False) https_prefix: Mapped[str] = mapped_column(String, nullable=False) - file_size: Mapped[int] = mapped_column(Integer, nullable=True) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, primary_key=True) + file_size: Mapped[int] = mapped_column(BigInteger, nullable=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, primary_key=True) diff --git a/apiv2/database/models/dataset_author.py b/apiv2/database/models/dataset_author.py index 388edd817..3a00e9d97 100644 --- a/apiv2/database/models/dataset_author.py +++ b/apiv2/database/models/dataset_author.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import Boolean, ForeignKey, Integer, String +from sqlalchemy import BigInteger, Boolean, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from platformics.database.models.base import Base @@ -29,14 +29,14 @@ class DatasetAuthor(Base): __tablename__ = "dataset_author" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - dataset_id: Mapped[int] = mapped_column(Integer, ForeignKey("dataset.id"), nullable=True, index=True) + dataset_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("dataset.id"), nullable=True, index=True) dataset: Mapped["Dataset"] = relationship( "Dataset", foreign_keys=dataset_id, back_populates="authors", ) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) - author_list_order: Mapped[int] = mapped_column(Integer, nullable=False) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) + author_list_order: Mapped[int] = mapped_column(BigInteger, nullable=False) orcid: Mapped[str] = mapped_column(String, nullable=True) name: Mapped[str] = mapped_column(String, nullable=False) email: Mapped[str] = mapped_column(String, nullable=True) diff --git a/apiv2/database/models/dataset_funding.py b/apiv2/database/models/dataset_funding.py index 86974cc60..f03fefe46 100644 --- a/apiv2/database/models/dataset_funding.py +++ b/apiv2/database/models/dataset_funding.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import ForeignKey, Integer, String +from sqlalchemy import BigInteger, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from platformics.database.models.base import Base @@ -29,7 +29,7 @@ class DatasetFunding(Base): __tablename__ = "dataset_funding" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - dataset_id: Mapped[int] = mapped_column(Integer, ForeignKey("dataset.id"), nullable=True, index=True) + dataset_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("dataset.id"), nullable=True, index=True) dataset: Mapped["Dataset"] = relationship( "Dataset", foreign_keys=dataset_id, @@ -37,4 +37,4 @@ class DatasetFunding(Base): ) funding_agency_name: Mapped[str] = mapped_column(String, nullable=True) grant_id: Mapped[str] = mapped_column(String, nullable=True) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/database/models/deposition.py b/apiv2/database/models/deposition.py index 75e59aa4d..cdd862b85 100644 --- a/apiv2/database/models/deposition.py +++ b/apiv2/database/models/deposition.py @@ -8,7 +8,7 @@ import datetime from typing import TYPE_CHECKING -from sqlalchemy import DateTime, Integer, String +from sqlalchemy import BigInteger, DateTime, String from sqlalchemy.orm import Mapped, mapped_column, relationship from platformics.database.models.base import Base @@ -109,4 +109,4 @@ class Deposition(Base): last_modified_date: Mapped[datetime.datetime] = mapped_column(DateTime(timezone=True), nullable=False) key_photo_url: Mapped[str] = mapped_column(String, nullable=True) key_photo_thumbnail_url: Mapped[str] = mapped_column(String, nullable=True) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/database/models/deposition_author.py b/apiv2/database/models/deposition_author.py index 6fc0bbf68..a42f4efe9 100644 --- a/apiv2/database/models/deposition_author.py +++ b/apiv2/database/models/deposition_author.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import Boolean, ForeignKey, Integer, String +from sqlalchemy import BigInteger, Boolean, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from platformics.database.models.base import Base @@ -29,14 +29,14 @@ class DepositionAuthor(Base): __tablename__ = "deposition_author" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - deposition_id: Mapped[int] = mapped_column(Integer, ForeignKey("deposition.id"), nullable=False, index=True) + deposition_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("deposition.id"), nullable=False, index=True) deposition: Mapped["Deposition"] = relationship( "Deposition", foreign_keys=deposition_id, back_populates="authors", ) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) - author_list_order: Mapped[int] = mapped_column(Integer, nullable=False) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) + author_list_order: Mapped[int] = mapped_column(BigInteger, nullable=False) orcid: Mapped[str] = mapped_column(String, nullable=True) name: Mapped[str] = mapped_column(String, nullable=False) email: Mapped[str] = mapped_column(String, nullable=True) diff --git a/apiv2/database/models/deposition_type.py b/apiv2/database/models/deposition_type.py index 84d78dcef..e1cd39e65 100644 --- a/apiv2/database/models/deposition_type.py +++ b/apiv2/database/models/deposition_type.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import Enum, ForeignKey, Integer +from sqlalchemy import BigInteger, Enum, ForeignKey from sqlalchemy.orm import Mapped, mapped_column, relationship from support.enums import deposition_types_enum @@ -30,11 +30,11 @@ class DepositionType(Base): __tablename__ = "deposition_type" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - deposition_id: Mapped[int] = mapped_column(Integer, ForeignKey("deposition.id"), nullable=False, index=True) + deposition_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("deposition.id"), nullable=False, index=True) deposition: Mapped["Deposition"] = relationship( "Deposition", foreign_keys=deposition_id, back_populates="deposition_types", ) type: Mapped[deposition_types_enum] = mapped_column(Enum(deposition_types_enum, native_enum=False), nullable=True) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/database/models/frame.py b/apiv2/database/models/frame.py index 96a8c8e7a..f03c4079a 100644 --- a/apiv2/database/models/frame.py +++ b/apiv2/database/models/frame.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import Boolean, Float, ForeignKey, Integer, String +from sqlalchemy import BigInteger, Boolean, Float, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from platformics.database.models.base import Base @@ -31,23 +31,23 @@ class Frame(Base): __tablename__ = "frame" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - deposition_id: Mapped[int] = mapped_column(Integer, ForeignKey("deposition.id"), nullable=False, index=True) + deposition_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("deposition.id"), nullable=False, index=True) deposition: Mapped["Deposition"] = relationship( "Deposition", foreign_keys=deposition_id, back_populates="frames", ) - run_id: Mapped[int] = mapped_column(Integer, ForeignKey("run.id"), nullable=False, index=True) + run_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("run.id"), nullable=False, index=True) run: Mapped["Run"] = relationship( "Run", foreign_keys=run_id, back_populates="frames", ) raw_angle: Mapped[float] = mapped_column(Float, nullable=True) - acquisition_order: Mapped[int] = mapped_column(Integer, nullable=True) + acquisition_order: Mapped[int] = mapped_column(BigInteger, nullable=True) dose: Mapped[float] = mapped_column(Float, nullable=True) is_gain_corrected: Mapped[bool] = mapped_column(Boolean, nullable=True) s3_frame_path: Mapped[str] = mapped_column(String, nullable=False) https_frame_path: Mapped[str] = mapped_column(String, nullable=False) - file_size: Mapped[int] = mapped_column(Integer, nullable=True) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + file_size: Mapped[int] = mapped_column(BigInteger, nullable=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/database/models/frame_acquisition_file.py b/apiv2/database/models/frame_acquisition_file.py index d9bb01b98..ddad4d371 100644 --- a/apiv2/database/models/frame_acquisition_file.py +++ b/apiv2/database/models/frame_acquisition_file.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import ForeignKey, Integer, String +from sqlalchemy import BigInteger, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from platformics.database.models.base import Base @@ -29,7 +29,7 @@ class FrameAcquisitionFile(Base): __tablename__ = "frame_acquisition_file" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - run_id: Mapped[int] = mapped_column(Integer, ForeignKey("run.id"), nullable=True, index=True) + run_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("run.id"), nullable=True, index=True) run: Mapped["Run"] = relationship( "Run", foreign_keys=run_id, @@ -37,4 +37,4 @@ class FrameAcquisitionFile(Base): ) s3_mdoc_path: Mapped[str] = mapped_column(String, nullable=False) https_mdoc_path: Mapped[str] = mapped_column(String, nullable=False) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/database/models/gain_file.py b/apiv2/database/models/gain_file.py index 63448cc63..0485db259 100644 --- a/apiv2/database/models/gain_file.py +++ b/apiv2/database/models/gain_file.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import ForeignKey, Integer, String +from sqlalchemy import BigInteger, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from platformics.database.models.base import Base @@ -29,7 +29,7 @@ class GainFile(Base): __tablename__ = "gain_file" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - run_id: Mapped[int] = mapped_column(Integer, ForeignKey("run.id"), nullable=False, index=True) + run_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("run.id"), nullable=False, index=True) run: Mapped["Run"] = relationship( "Run", foreign_keys=run_id, @@ -37,4 +37,4 @@ class GainFile(Base): ) s3_file_path: Mapped[str] = mapped_column(String, nullable=False) https_file_path: Mapped[str] = mapped_column(String, nullable=False) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/database/models/per_section_alignment_parameters.py b/apiv2/database/models/per_section_alignment_parameters.py index 13a45d0ac..de940d298 100644 --- a/apiv2/database/models/per_section_alignment_parameters.py +++ b/apiv2/database/models/per_section_alignment_parameters.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import Float, ForeignKey, Integer +from sqlalchemy import BigInteger, Float, ForeignKey from sqlalchemy.dialects.postgresql import JSONB from sqlalchemy.orm import Mapped, mapped_column, relationship @@ -30,16 +30,16 @@ class PerSectionAlignmentParameters(Base): __tablename__ = "per_section_alignment_parameters" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - alignment_id: Mapped[int] = mapped_column(Integer, ForeignKey("alignment.id"), nullable=False, index=True) + alignment_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("alignment.id"), nullable=False, index=True) alignment: Mapped["Alignment"] = relationship( "Alignment", foreign_keys=alignment_id, back_populates="per_section_alignments", ) - z_index: Mapped[int] = mapped_column(Integer, nullable=False) + z_index: Mapped[int] = mapped_column(BigInteger, nullable=False) x_offset: Mapped[float] = mapped_column(Float, nullable=True) y_offset: Mapped[float] = mapped_column(Float, nullable=True) volume_x_rotation: Mapped[float] = mapped_column(Float, nullable=True) in_plane_rotation: Mapped[JSONB] = mapped_column(JSONB, nullable=True) tilt_angle: Mapped[float] = mapped_column(Float, nullable=True) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/database/models/run.py b/apiv2/database/models/run.py index 347aa961f..24b191c1d 100644 --- a/apiv2/database/models/run.py +++ b/apiv2/database/models/run.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import ForeignKey, Integer, String +from sqlalchemy import BigInteger, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from platformics.database.models.base import Base @@ -51,7 +51,7 @@ class Run(Base): annotations: Mapped[list[Annotation]] = relationship( "Annotation", back_populates="run", uselist=True, foreign_keys="Annotation.run_id", cascade="all, delete-orphan", ) - dataset_id: Mapped[int] = mapped_column(Integer, ForeignKey("dataset.id"), nullable=False, index=True) + dataset_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("dataset.id"), nullable=False, index=True) dataset: Mapped["Dataset"] = relationship( "Dataset", foreign_keys=dataset_id, @@ -86,4 +86,4 @@ class Run(Base): name: Mapped[str] = mapped_column(String, nullable=False) s3_prefix: Mapped[str] = mapped_column(String, nullable=False) https_prefix: Mapped[str] = mapped_column(String, nullable=False) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/database/models/tiltseries.py b/apiv2/database/models/tiltseries.py index 5424dbb6f..7f7c29406 100644 --- a/apiv2/database/models/tiltseries.py +++ b/apiv2/database/models/tiltseries.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import Boolean, Enum, Float, ForeignKey, Integer, String +from sqlalchemy import BigInteger, Boolean, Enum, Float, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from support.enums import tiltseries_microscope_manufacturer_enum @@ -41,27 +41,27 @@ class Tiltseries(Base): foreign_keys="Alignment.tiltseries_id", cascade="all, delete-orphan", ) - run_id: Mapped[int] = mapped_column(Integer, ForeignKey("run.id"), nullable=False, index=True) + run_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("run.id"), nullable=False, index=True) run: Mapped["Run"] = relationship( "Run", foreign_keys=run_id, back_populates="tiltseries", ) - deposition_id: Mapped[int] = mapped_column(Integer, ForeignKey("deposition.id"), nullable=True, index=True) + deposition_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("deposition.id"), nullable=True, index=True) deposition: Mapped["Deposition"] = relationship( "Deposition", foreign_keys=deposition_id, back_populates="tiltseries", ) s3_omezarr_dir: Mapped[str] = mapped_column(String, nullable=True) - file_size_omezarr: Mapped[int] = mapped_column(Integer, nullable=True) + file_size_omezarr: Mapped[int] = mapped_column(BigInteger, nullable=True) s3_mrc_file: Mapped[str] = mapped_column(String, nullable=True) - file_size_mrc: Mapped[int] = mapped_column(Integer, nullable=True) + file_size_mrc: Mapped[int] = mapped_column(BigInteger, nullable=True) https_omezarr_dir: Mapped[str] = mapped_column(String, nullable=True) https_mrc_file: Mapped[str] = mapped_column(String, nullable=True) s3_angle_list: Mapped[str] = mapped_column(String, nullable=True) https_angle_list: Mapped[str] = mapped_column(String, nullable=True) - acceleration_voltage: Mapped[int] = mapped_column(Integer, nullable=False) + acceleration_voltage: Mapped[int] = mapped_column(BigInteger, nullable=False) spherical_aberration_constant: Mapped[float] = mapped_column(Float, nullable=False) microscope_manufacturer: Mapped[tiltseries_microscope_manufacturer_enum] = mapped_column( Enum(tiltseries_microscope_manufacturer_enum, native_enum=False), nullable=False, @@ -83,11 +83,11 @@ class Tiltseries(Base): data_acquisition_software: Mapped[str] = mapped_column(String, nullable=False) related_empiar_entry: Mapped[str] = mapped_column(String, nullable=True) binning_from_frames: Mapped[float] = mapped_column(Float, nullable=True) - tilt_series_quality: Mapped[int] = mapped_column(Integer, nullable=False) + tilt_series_quality: Mapped[int] = mapped_column(BigInteger, nullable=False) is_aligned: Mapped[bool] = mapped_column(Boolean, nullable=False) pixel_spacing: Mapped[float] = mapped_column(Float, nullable=False) - aligned_tiltseries_binning: Mapped[int] = mapped_column(Integer, nullable=True) - size_x: Mapped[int] = mapped_column(Integer, nullable=True) - size_y: Mapped[int] = mapped_column(Integer, nullable=True) - size_z: Mapped[int] = mapped_column(Integer, nullable=True) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + aligned_tiltseries_binning: Mapped[int] = mapped_column(BigInteger, nullable=True) + size_x: Mapped[int] = mapped_column(BigInteger, nullable=True) + size_y: Mapped[int] = mapped_column(BigInteger, nullable=True) + size_z: Mapped[int] = mapped_column(BigInteger, nullable=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/database/models/tomogram.py b/apiv2/database/models/tomogram.py index 111c697ef..7581a4ed0 100644 --- a/apiv2/database/models/tomogram.py +++ b/apiv2/database/models/tomogram.py @@ -8,7 +8,7 @@ import datetime from typing import TYPE_CHECKING -from sqlalchemy import Boolean, DateTime, Enum, Float, ForeignKey, Integer, String +from sqlalchemy import BigInteger, Boolean, DateTime, Enum, Float, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from support.enums import fiducial_alignment_status_enum, tomogram_processing_enum, tomogram_reconstruction_method_enum @@ -39,7 +39,7 @@ class Tomogram(Base): __tablename__ = "tomogram" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - alignment_id: Mapped[int] = mapped_column(Integer, ForeignKey("alignment.id"), nullable=True, index=True) + alignment_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("alignment.id"), nullable=True, index=True) alignment: Mapped["Alignment"] = relationship( "Alignment", foreign_keys=alignment_id, @@ -52,20 +52,20 @@ class Tomogram(Base): foreign_keys="TomogramAuthor.tomogram_id", cascade="all, delete-orphan", ) - deposition_id: Mapped[int] = mapped_column(Integer, ForeignKey("deposition.id"), nullable=False, index=True) + deposition_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("deposition.id"), nullable=False, index=True) deposition: Mapped["Deposition"] = relationship( "Deposition", foreign_keys=deposition_id, back_populates="tomograms", ) - run_id: Mapped[int] = mapped_column(Integer, ForeignKey("run.id"), nullable=True, index=True) + run_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("run.id"), nullable=True, index=True) run: Mapped["Run"] = relationship( "Run", foreign_keys=run_id, back_populates="tomograms", ) tomogram_voxel_spacing_id: Mapped[int] = mapped_column( - Integer, ForeignKey("tomogram_voxel_spacing.id"), nullable=True, index=True, + BigInteger, ForeignKey("tomogram_voxel_spacing.id"), nullable=True, index=True, ) tomogram_voxel_spacing: Mapped["TomogramVoxelSpacing"] = relationship( "TomogramVoxelSpacing", @@ -73,9 +73,9 @@ class Tomogram(Base): back_populates="tomograms", ) name: Mapped[str] = mapped_column(String, nullable=True) - size_x: Mapped[int] = mapped_column(Integer, nullable=False) - size_y: Mapped[int] = mapped_column(Integer, nullable=False) - size_z: Mapped[int] = mapped_column(Integer, nullable=False) + size_x: Mapped[int] = mapped_column(BigInteger, nullable=False) + size_y: Mapped[int] = mapped_column(BigInteger, nullable=False) + size_z: Mapped[int] = mapped_column(BigInteger, nullable=False) voxel_spacing: Mapped[float] = mapped_column(Float, nullable=False) fiducial_alignment_status: Mapped[fiducial_alignment_status_enum] = mapped_column( Enum(fiducial_alignment_status_enum, native_enum=False), nullable=False, @@ -94,23 +94,23 @@ class Tomogram(Base): is_visualization_default: Mapped[bool] = mapped_column(Boolean, nullable=True) s3_omezarr_dir: Mapped[str] = mapped_column(String, nullable=True) https_omezarr_dir: Mapped[str] = mapped_column(String, nullable=True) - file_size_omezarr: Mapped[int] = mapped_column(Integer, nullable=True) + file_size_omezarr: Mapped[int] = mapped_column(BigInteger, nullable=True) s3_mrc_file: Mapped[str] = mapped_column(String, nullable=True) https_mrc_file: Mapped[str] = mapped_column(String, nullable=True) - file_size_mrc: Mapped[int] = mapped_column(Integer, nullable=True) + file_size_mrc: Mapped[int] = mapped_column(BigInteger, nullable=True) scale0_dimensions: Mapped[str] = mapped_column(String, nullable=True) scale1_dimensions: Mapped[str] = mapped_column(String, nullable=True) scale2_dimensions: Mapped[str] = mapped_column(String, nullable=True) ctf_corrected: Mapped[bool] = mapped_column(Boolean, nullable=True) - offset_x: Mapped[int] = mapped_column(Integer, nullable=False) - offset_y: Mapped[int] = mapped_column(Integer, nullable=False) - offset_z: Mapped[int] = mapped_column(Integer, nullable=False) + offset_x: Mapped[int] = mapped_column(BigInteger, nullable=False) + offset_y: Mapped[int] = mapped_column(BigInteger, nullable=False) + offset_z: Mapped[int] = mapped_column(BigInteger, nullable=False) key_photo_url: Mapped[str] = mapped_column(String, nullable=True) key_photo_thumbnail_url: Mapped[str] = mapped_column(String, nullable=True) neuroglancer_config: Mapped[str] = mapped_column(String, nullable=True) publications: Mapped[str] = mapped_column(String, nullable=True) related_database_entries: Mapped[str] = mapped_column(String, nullable=True) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) deposition_date: Mapped[datetime.datetime] = mapped_column(DateTime(timezone=True), nullable=True) release_date: Mapped[datetime.datetime] = mapped_column(DateTime(timezone=True), nullable=True) last_modified_date: Mapped[datetime.datetime] = mapped_column(DateTime(timezone=True), nullable=True) diff --git a/apiv2/database/models/tomogram_author.py b/apiv2/database/models/tomogram_author.py index 4586558ef..d37fcc494 100644 --- a/apiv2/database/models/tomogram_author.py +++ b/apiv2/database/models/tomogram_author.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import Boolean, ForeignKey, Integer, String +from sqlalchemy import BigInteger, Boolean, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from platformics.database.models.base import Base @@ -29,14 +29,14 @@ class TomogramAuthor(Base): __tablename__ = "tomogram_author" __mapper_args__ = {"polymorphic_identity": __tablename__, "polymorphic_load": "inline"} - tomogram_id: Mapped[int] = mapped_column(Integer, ForeignKey("tomogram.id"), nullable=True, index=True) + tomogram_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("tomogram.id"), nullable=True, index=True) tomogram: Mapped["Tomogram"] = relationship( "Tomogram", foreign_keys=tomogram_id, back_populates="authors", ) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) - author_list_order: Mapped[int] = mapped_column(Integer, nullable=False) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) + author_list_order: Mapped[int] = mapped_column(BigInteger, nullable=False) orcid: Mapped[str] = mapped_column(String, nullable=True) name: Mapped[str] = mapped_column(String, nullable=False) email: Mapped[str] = mapped_column(String, nullable=True) diff --git a/apiv2/database/models/tomogram_voxel_spacing.py b/apiv2/database/models/tomogram_voxel_spacing.py index 7e5c1f8b6..312dc9f11 100644 --- a/apiv2/database/models/tomogram_voxel_spacing.py +++ b/apiv2/database/models/tomogram_voxel_spacing.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING -from sqlalchemy import Float, ForeignKey, Integer, String +from sqlalchemy import BigInteger, Float, ForeignKey, String from sqlalchemy.orm import Mapped, mapped_column, relationship from platformics.database.models.base import Base @@ -40,7 +40,7 @@ class TomogramVoxelSpacing(Base): foreign_keys="AnnotationFile.tomogram_voxel_spacing_id", cascade="all, delete-orphan", ) - run_id: Mapped[int] = mapped_column(Integer, ForeignKey("run.id"), nullable=True, index=True) + run_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("run.id"), nullable=True, index=True) run: Mapped["Run"] = relationship( "Run", foreign_keys=run_id, @@ -56,4 +56,4 @@ class TomogramVoxelSpacing(Base): voxel_spacing: Mapped[float] = mapped_column(Float, nullable=False) s3_prefix: Mapped[str] = mapped_column(String, nullable=False) https_prefix: Mapped[str] = mapped_column(String, nullable=False) - id: Mapped[int] = mapped_column(Integer, nullable=False, index=True, autoincrement=True, primary_key=True) + id: Mapped[int] = mapped_column(BigInteger, nullable=False, index=True, autoincrement=True, primary_key=True) diff --git a/apiv2/db_import/importers/base.py b/apiv2/db_import/importers/base.py index d6b082373..20f018700 100644 --- a/apiv2/db_import/importers/base.py +++ b/apiv2/db_import/importers/base.py @@ -55,12 +55,11 @@ def get_file_size(self, *input_path: tuple[str]) -> str: total_size = 0 try: response = self.config.s3_client.list_objects_v2(Bucket=self.config.bucket_name, Prefix=input_path) - if 'Contents' in response: - for obj in response['Contents']: - total_size += obj['Size'] + if "Contents" in response: + for obj in response["Contents"]: + total_size += obj["Size"] - total_size_mb = round(total_size / (1024 * 1024)) - return total_size_mb if total_size_mb > 1 else None + return total_size except Exception as e: print(f"Error retrieving folder size: {e}") return None diff --git a/apiv2/db_import/importers/base_importer.py b/apiv2/db_import/importers/base_importer.py index a8331f988..95f08913f 100644 --- a/apiv2/db_import/importers/base_importer.py +++ b/apiv2/db_import/importers/base_importer.py @@ -87,16 +87,16 @@ def get_file_size(self, *input_path: tuple[str]) -> str: total_size = 0 try: response = self.config.s3_client.list_objects_v2(Bucket=self.config.bucket_name, Prefix=input_path) - if 'Contents' in response: - for obj in response['Contents']: - total_size += obj['Size'] + if "Contents" in response: + for obj in response["Contents"]: + total_size += obj["Size"] - total_size_mb = round(total_size / (1024 * 1024)) - return total_size_mb if total_size_mb > 1 else None + return total_size except Exception as e: print(f"Error retrieving folder size: {e}") return None + class StaleDeletionDBImporter(BaseDBImporter): """ Supports insert of new record, update of existing record, and delete of stale records. This class iterates over a diff --git a/apiv2/platformics/codegen/templates/database/models/class_name.py.j2 b/apiv2/platformics/codegen/templates/database/models/class_name.py.j2 index 1e51fe170..d44a8afae 100644 --- a/apiv2/platformics/codegen/templates/database/models/class_name.py.j2 +++ b/apiv2/platformics/codegen/templates/database/models/class_name.py.j2 @@ -14,7 +14,7 @@ import datetime from typing import TYPE_CHECKING from platformics.database.models.base import Base -from sqlalchemy import ForeignKey, String, Float, Integer, Enum, Boolean, DateTime +from sqlalchemy import ForeignKey, String, Float, BigInteger, Enum, Boolean, DateTime from sqlalchemy.dialects.postgresql import UUID, JSONB from sqlalchemy.orm import Mapped, mapped_column, relationship from sqlalchemy.sql import func @@ -68,7 +68,7 @@ class {{cls.name}}({%- if cls.is_a %}{{cls.is_a}}{%- else %}Base{%- endif %}): "uuid": ("UUID", "uuid.UUID"), "string": ("String", "str"), "Array2dFloat": ("JSONB", "JSONB"), - "integer": ("Integer", "int"), + "integer": ("BigInteger", "int"), "float": ("Float", "float"), "boolean": ("Boolean", "bool"), "date": ("DateTime(timezone=True)", "datetime.datetime"), diff --git a/apiv2/scripts/scrape.py b/apiv2/scripts/scrape.py index 560234fa2..4f40f29f3 100644 --- a/apiv2/scripts/scrape.py +++ b/apiv2/scripts/scrape.py @@ -367,13 +367,16 @@ def fetch_method_links(client_url, annotation): headers = { "Content-type": "application/json", } - query = """ + query = ( + """ query MyQuery { annotations(where: {id: {_eq: %d }}) { method_links } } - """ % annotation.id + """ + % annotation.id + ) payload = json.dumps({"query": query, "variables": None, "operationName": "MyQuery"}) res = requests.post(client_url, headers=headers, data=payload) data = res.json()