Skip to content

Commit

Permalink
🗃️ update alembic script
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Burg committed Jan 8, 2024
1 parent f8eaa70 commit 332f987
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""add-column-user-address-in-operations
Revision ID: 0894f3022876
Revises: a6daf80cf2a0
Revises: 899856207a89
Create Date: 2024-01-04 16:56:40.833512
"""
Expand All @@ -13,7 +13,7 @@

# revision identifiers, used by Alembic.
revision: str = "0894f3022876"
down_revision: Union[str, None] = "a6daf80cf2a0"
down_revision: Union[str, None] = "899856207a89"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None

Expand Down
44 changes: 44 additions & 0 deletions alembic/versions/899856207a89_create_table_operations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""create-table-operations
Revision ID: 899856207a89
Revises: a6daf80cf2a0
Create Date: 2024-01-08 10:12:30.192936
"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision: str = "899856207a89"
down_revision: Union[str, None] = "a6daf80cf2a0"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.create_table(
"operations",
sa.Column("id", sa.UUID(), nullable=False),
sa.Column(
"cost",
postgresql.INTEGER(),
nullable=True,
),
sa.Column(
"contract_id", sa.UUID(), sa.ForeignKey("contracts.id"), nullable=True
),
sa.Column(
"entrypoint_id", sa.UUID(), sa.ForeignKey("entrypoints.id"), nullable=True
),
sa.Column("hash", sa.TEXT(), nullable=True),
sa.Column("status", sa.TEXT(), nullable=True),
sa.Column("created_at", sa.TIMESTAMP(), nullable=True),
sa.PrimaryKeyConstraint("id", name="operations_pkey"),
)


def downgrade() -> None:
op.drop_table("operations")

0 comments on commit 332f987

Please sign in to comment.