-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'lando-api-repo/main' into zeid/bug-1944…
…562-merge-lando-api
- Loading branch information
Showing
37 changed files
with
4,859 additions
and
1,957 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
133 changes: 133 additions & 0 deletions
133
migrations/versions/1dfc5aa9d1b2_add_treestatus_models.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,133 @@ | ||
"""add treestatus models | ||
Revision ID: 1dfc5aa9d1b2 | ||
Revises: 56c6748ee7cf | ||
Create Date: 2023-11-29 01:48:07.449510 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "1dfc5aa9d1b2" | ||
down_revision = "56c6748ee7cf" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"status_change", | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False), | ||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False), | ||
sa.Column("changed_by", sa.Text(), nullable=False), | ||
sa.Column("reason", sa.Text(), nullable=False), | ||
sa.Column( | ||
"status", | ||
sa.Enum("OPEN", "CLOSED", "APPROVAL_REQUIRED", name="treestatus"), | ||
nullable=False, | ||
), | ||
sa.PrimaryKeyConstraint("id"), | ||
) | ||
op.create_table( | ||
"tree", | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False), | ||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False), | ||
sa.Column("tree", sa.String(length=64), nullable=False), | ||
sa.Column( | ||
"status", | ||
sa.Enum("OPEN", "CLOSED", "APPROVAL_REQUIRED", name="treestatus"), | ||
nullable=False, | ||
), | ||
sa.Column("reason", sa.Text(), nullable=False), | ||
sa.Column("message_of_the_day", sa.Text(), nullable=False), | ||
sa.Column( | ||
"category", | ||
sa.Enum( | ||
"DEVELOPMENT", | ||
"RELEASE_STABILIZATION", | ||
"TRY", | ||
"COMM_REPOS", | ||
"OTHER", | ||
name="treecategory", | ||
), | ||
nullable=False, | ||
), | ||
sa.PrimaryKeyConstraint("id"), | ||
) | ||
op.create_index(op.f("ix_tree_tree"), "tree", ["tree"], unique=True) | ||
op.create_table( | ||
"log", | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False), | ||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False), | ||
sa.Column("tree", sa.String(length=64), nullable=False), | ||
sa.Column("changed_by", sa.Text(), nullable=False), | ||
sa.Column( | ||
"status", | ||
sa.Enum("OPEN", "CLOSED", "APPROVAL_REQUIRED", name="treestatus"), | ||
nullable=False, | ||
), | ||
sa.Column("reason", sa.Text(), nullable=False), | ||
sa.Column( | ||
"tags", | ||
postgresql.JSONB(astext_type=sa.Text()), | ||
nullable=False, | ||
server_default="[]", | ||
), | ||
sa.ForeignKeyConstraint( | ||
["tree"], | ||
["tree.tree"], | ||
), | ||
sa.PrimaryKeyConstraint("id"), | ||
) | ||
op.create_index(op.f("ix_log_tree"), "log", ["tree"], unique=False) | ||
op.create_table( | ||
"status_change_tree", | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False), | ||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False), | ||
sa.Column("stack_id", sa.Integer(), nullable=True), | ||
sa.Column("tree", sa.String(length=64), nullable=False), | ||
sa.Column( | ||
"last_state", postgresql.JSONB(astext_type=sa.Text()), nullable=False | ||
), | ||
sa.ForeignKeyConstraint( | ||
["stack_id"], | ||
["status_change.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["tree"], | ||
["tree.tree"], | ||
), | ||
sa.PrimaryKeyConstraint("id"), | ||
) | ||
op.create_index( | ||
op.f("ix_status_change_tree_stack_id"), | ||
"status_change_tree", | ||
["stack_id"], | ||
unique=False, | ||
) | ||
op.create_index( | ||
op.f("ix_status_change_tree_tree"), "status_change_tree", ["tree"], unique=False | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index(op.f("ix_status_change_tree_tree"), table_name="status_change_tree") | ||
op.drop_index( | ||
op.f("ix_status_change_tree_stack_id"), table_name="status_change_tree" | ||
) | ||
op.drop_table("status_change_tree") | ||
op.drop_index(op.f("ix_log_tree"), table_name="log") | ||
op.drop_table("log") | ||
op.drop_index(op.f("ix_tree_tree"), table_name="tree") | ||
op.drop_table("tree") | ||
op.drop_table("status_change") | ||
# ### 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
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
Oops, something went wrong.