Added a new backend settings system

This can be used for saving runtime-configurable settings in the database.
This commit is contained in:
Donkie
2024-01-03 18:44:09 +01:00
parent cad6d4a7f7
commit 44da991d47
11 changed files with 573 additions and 3 deletions

View File

@@ -0,0 +1,32 @@
"""Added Settings table.
Revision ID: ccbb17aeda7c
Revises: 92793c8a937c
Create Date: 2024-01-03 13:46:41.362341
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "ccbb17aeda7c"
down_revision = "92793c8a937c"
branch_labels = None
depends_on = None
def upgrade() -> None:
"""Perform the upgrade."""
op.create_table(
"setting",
sa.Column("key", sa.String(length=64), nullable=False),
sa.Column("value", sa.Text(), nullable=False),
sa.Column("last_updated", sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint("key"),
)
op.create_index(op.f("ix_setting_key"), "setting", ["key"], unique=False)
def downgrade() -> None:
"""Perform the downgrade."""
op.drop_index(op.f("ix_setting_key"), table_name="setting")
op.drop_table("setting")