/ migrations / versions / 2024_01_03_1346-ccbb17aeda7c_added_settings_table.py
2024_01_03_1346-ccbb17aeda7c_added_settings_table.py
 1  """Added Settings table.
 2  
 3  Revision ID: ccbb17aeda7c
 4  Revises: b82cd9e2aa6f
 5  Create Date: 2024-01-03 13:46:41.362341
 6  """
 7  
 8  import sqlalchemy as sa
 9  from alembic import op
10  
11  # revision identifiers, used by Alembic.
12  revision = "ccbb17aeda7c"
13  down_revision = "b82cd9e2aa6f"
14  branch_labels = None
15  depends_on = None
16  
17  
18  def upgrade() -> None:
19      """Perform the upgrade."""
20      op.create_table(
21          "setting",
22          sa.Column("key", sa.String(length=64), nullable=False),
23          sa.Column("value", sa.Text(), nullable=False),
24          sa.Column("last_updated", sa.DateTime(), nullable=False),
25          sa.PrimaryKeyConstraint("key"),
26      )
27      op.create_index(op.f("ix_setting_key"), "setting", ["key"], unique=False)
28  
29  
30  def downgrade() -> None:
31      """Perform the downgrade."""
32      op.drop_index(op.f("ix_setting_key"), table_name="setting")
33      op.drop_table("setting")