Added column to post table for lang with US english set to default. Included alembic migration

This commit is contained in:
Graeme Harris
2022-12-28 23:25:29 +02:00
parent c02075b9cc
commit 00ebf90871
2 changed files with 30 additions and 0 deletions
@@ -0,0 +1,29 @@
"""Added lang column for ISO-639-1 codes
Revision ID: ef0b52902560
Revises: 3358eb6834e6
Create Date: 2022-12-28 18:24:21.393973
"""
from alembic import op
import sqlalchemy as sa
import sqlmodel
# revision identifiers, used by Alembic.
revision = 'ef0b52902560'
down_revision = '3358eb6834e6'
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('post', sa.Column('lang', sqlmodel.sql.sqltypes.AutoString(length=200), nullable=False, default="en-US"))
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('post', 'lang')
# ### end Alembic commands ###
+1
View File
@@ -31,3 +31,4 @@ class Post(SQLModel, table=True):
)
payload_type: str = Field(nullable=False, max_length=200)
payload: PayloadContainer = Field(sa_column=sa.Column(payload_column_type(PayloadContainer), nullable=True))
lang: str = Field(nullable=False, max_length=200, default="en-US")