-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cigrid-ui-412 new column types (#74) (major)
### CHANGED - Types for method document and method version in the plate table were changed to string. - Added indexes to python models to match database schema. --------- Co-authored-by: isakohlsson <isak.ohlsson@scilifelab.se>
- Loading branch information
Showing
10 changed files
with
131 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
alembic/versions/7f77cbc00305_change_version_field_type.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
"""Change version field type | ||
Revision ID: 7f77cbc00305 | ||
Revises: 21ef5ce15822 | ||
Create Date: 2023-05-15 16:46:03.718794 | ||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "7f77cbc00305" | ||
down_revision = "21ef5ce15822" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import mysql | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index("plate_id", table_name="plate") | ||
op.create_index(op.f("ix_plate_plate_id"), "plate", ["plate_id"], unique=True) | ||
op.alter_column("user", "email", existing_type=mysql.VARCHAR(length=128), nullable=False) | ||
op.drop_index("email", table_name="user") | ||
op.drop_index("google_id", table_name="user") | ||
op.create_index(op.f("ix_user_email"), "user", ["email"], unique=True) | ||
op.drop_column("user", "avatar") | ||
op.drop_column("user", "google_id") | ||
op.alter_column( | ||
"plate", | ||
"method_document", | ||
existing_type=mysql.INTEGER(), | ||
type_=mysql.VARCHAR(length=128), | ||
) | ||
op.alter_column( | ||
"plate", | ||
"method_version", | ||
existing_type=mysql.INTEGER(), | ||
type_=mysql.VARCHAR(length=16), | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column( | ||
"plate", | ||
"method_version", | ||
existing_type=mysql.VARCHAR(length=16), | ||
type_=mysql.INTEGER(), | ||
) | ||
op.alter_column( | ||
"plate", | ||
"method_document", | ||
existing_type=mysql.VARCHAR(length=128), | ||
type_=mysql.INTEGER(), | ||
) | ||
|
||
op.add_column("user", sa.Column("google_id", mysql.VARCHAR(length=128), nullable=True)) | ||
op.add_column("user", sa.Column("avatar", mysql.TEXT(), nullable=True)) | ||
op.drop_index(op.f("ix_user_email"), table_name="user") | ||
op.create_index("google_id", "user", ["google_id"], unique=False) | ||
op.create_index("email", "user", ["email"], unique=False) | ||
op.alter_column("user", "email", existing_type=mysql.VARCHAR(length=128), nullable=True) | ||
op.drop_index(op.f("ix_plate_plate_id"), table_name="plate") | ||
op.create_index("plate_id", "plate", ["plate_id"], unique=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters