-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): Add OrganizationSetting table to db
- Loading branch information
1 parent
247d4aa
commit a55f8a2
Showing
2 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
alembic/versions/496c162975d7_add_organization_settings_table.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,71 @@ | ||
"""Add organization settings table | ||
Revision ID: 496c162975d7 | ||
Revises: 9194fb66b4ea | ||
Create Date: 2025-01-09 00:02:47.484038 | ||
""" | ||
from collections.abc import Sequence | ||
|
||
import sqlalchemy as sa | ||
import sqlmodel.sql.sqltypes | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "496c162975d7" | ||
down_revision: str | None = "9194fb66b4ea" | ||
branch_labels: str | Sequence[str] | None = None | ||
depends_on: str | Sequence[str] | None = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"organization_settings", | ||
sa.Column("surrogate_id", sa.Integer(), nullable=False), | ||
sa.Column("owner_id", sqlmodel.sql.sqltypes.GUID(), nullable=False), | ||
sa.Column( | ||
"created_at", | ||
sa.TIMESTAMP(timezone=True), | ||
server_default=sa.text("now()"), | ||
nullable=False, | ||
), | ||
sa.Column( | ||
"updated_at", | ||
sa.TIMESTAMP(timezone=True), | ||
server_default=sa.text("now()"), | ||
nullable=False, | ||
), | ||
sa.Column("id", sqlmodel.sql.sqltypes.GUID(), nullable=False), | ||
sa.Column("key", sqlmodel.sql.sqltypes.AutoString(), nullable=False), | ||
sa.Column("value", sa.LargeBinary(), nullable=False), | ||
sa.Column("value_type", sqlmodel.sql.sqltypes.AutoString(), nullable=False), | ||
sa.Column("is_encrypted", sa.Boolean(), nullable=False), | ||
sa.PrimaryKeyConstraint("surrogate_id"), | ||
) | ||
op.create_index( | ||
op.f("ix_organization_settings_id"), | ||
"organization_settings", | ||
["id"], | ||
unique=True, | ||
) | ||
op.create_index( | ||
op.f("ix_organization_settings_key"), | ||
"organization_settings", | ||
["key"], | ||
unique=True, | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index( | ||
op.f("ix_organization_settings_key"), table_name="organization_settings" | ||
) | ||
op.drop_index( | ||
op.f("ix_organization_settings_id"), table_name="organization_settings" | ||
) | ||
op.drop_table("organization_settings") | ||
# ### end Alembic commands ### |
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