-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8acb42b
commit 61f5255
Showing
4 changed files
with
103 additions
and
74 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
backend/app/alembic/versions/966d8d72887e_add_gerrydb_schema.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,57 @@ | ||
"""add gerrydb schema | ||
Revision ID: 966d8d72887e | ||
Revises: | ||
Create Date: 2024-07-20 10:50:48.136439 | ||
""" | ||
|
||
from typing import Sequence, Union | ||
|
||
import sqlalchemy as sa | ||
import sqlmodel.sql.sqltypes | ||
from alembic import op | ||
from app.models import UUIDType | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "966d8d72887e" | ||
down_revision: Union[str, None] = None | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.execute(sa.text("CREATE EXTENSION IF NOT EXISTS postgis")) | ||
op.execute(sa.text("CREATE SCHEMA IF NOT EXISTS gerrydb")) | ||
op.create_table( | ||
"gerrydbtable", | ||
sa.Column( | ||
"created_at", | ||
sa.TIMESTAMP(timezone=True), | ||
server_default=sa.text("CURRENT_TIMESTAMP"), | ||
nullable=False, | ||
), | ||
sa.Column( | ||
"updated_at", | ||
sa.TIMESTAMP(timezone=True), | ||
server_default=sa.text("CURRENT_TIMESTAMP"), | ||
nullable=False, | ||
), | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("uuid", UUIDType(), nullable=True), | ||
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False), | ||
sa.PrimaryKeyConstraint("id"), | ||
sa.UniqueConstraint("name"), | ||
sa.UniqueConstraint("uuid"), | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table("gerrydbtable") | ||
op.execute(sa.text("DROP SCHEMA IF EXISTS gerrydb CASCADE")) | ||
op.execute(sa.text("DROP EXTENSION IF EXISTS postgis")) | ||
# ### end Alembic commands ### |
This file was deleted.
Oops, something went wrong.
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
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