fix: SQL integer column types
We used NUMBER[sic!] as column type in our SQL, which does not exist. The way SQLite works this mapped to NUMERIC, which is not what we meant, we really wanted INTEGER here.
This commit is contained in:
parent
feb60bf658
commit
5eb7211b59
1 changed files with 69 additions and 0 deletions
69
alembic/versions/1716049471-c08ae04dc482_fix_data_types.py
Normal file
69
alembic/versions/1716049471-c08ae04dc482_fix_data_types.py
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
"""fix data types
|
||||
|
||||
Revision ID: c08ae04dc482
|
||||
Revises:
|
||||
Create Date: 2024-05-18 16:24:31.152480+00:00
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "c08ae04dc482"
|
||||
down_revision: str | None = None
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table("ratings", schema=None) as batch_op:
|
||||
batch_op.alter_column(
|
||||
"score",
|
||||
existing_type=sa.NUMERIC(),
|
||||
type_=sa.Integer(),
|
||||
existing_nullable=False,
|
||||
)
|
||||
batch_op.alter_column(
|
||||
"favorite",
|
||||
existing_type=sa.NUMERIC(),
|
||||
type_=sa.Integer(),
|
||||
existing_nullable=True,
|
||||
)
|
||||
batch_op.alter_column(
|
||||
"finished",
|
||||
existing_type=sa.NUMERIC(),
|
||||
type_=sa.Integer(),
|
||||
existing_nullable=True,
|
||||
)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table("ratings", schema=None) as batch_op:
|
||||
batch_op.alter_column(
|
||||
"finished",
|
||||
existing_type=sa.Integer(),
|
||||
type_=sa.NUMERIC(),
|
||||
existing_nullable=True,
|
||||
)
|
||||
batch_op.alter_column(
|
||||
"favorite",
|
||||
existing_type=sa.Integer(),
|
||||
type_=sa.NUMERIC(),
|
||||
existing_nullable=True,
|
||||
)
|
||||
batch_op.alter_column(
|
||||
"score",
|
||||
existing_type=sa.Integer(),
|
||||
type_=sa.NUMERIC(),
|
||||
existing_nullable=False,
|
||||
)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
Loading…
Add table
Add a link
Reference in a new issue