1"""Add the configurations table.
2
3Revision ID: 679e695af6ba
4Revises: 5bff7878e700
5Create Date: 2022-02-17 21:17:27.832400
6
7"""
8
9import sqlalchemy as sa
10from alembic import op
11
12import prefect
13
14# revision identifiers, used by Alembic.
15revision = "679e695af6ba"
16down_revision = "5bff7878e700"
17branch_labels = None
18depends_on = None
19
20
21def upgrade():
22 # ### commands auto generated by Alembic - please adjust! ###
23 op.create_table(
24 "configuration",
25 sa.Column(
26 "id",
27 prefect.server.utilities.database.UUID(),
28 server_default=sa.text("(GEN_RANDOM_UUID())"),
29 nullable=False,
30 ),
31 sa.Column(
32 "created",
33 prefect.server.utilities.database.Timestamp(timezone=True),
34 server_default=sa.text("CURRENT_TIMESTAMP"),
35 nullable=False,
36 ),
37 sa.Column(
38 "updated",
39 prefect.server.utilities.database.Timestamp(timezone=True),
40 server_default=sa.text("CURRENT_TIMESTAMP"),
41 nullable=False,
42 ),
43 sa.Column("key", sa.String(), nullable=False),
44 sa.Column(
45 "value",
46 prefect.server.utilities.database.JSON(astext_type=sa.Text()),
47 nullable=False,
48 ),
49 sa.PrimaryKeyConstraint("id", name=op.f("pk_configuration")),
50 sa.UniqueConstraint("key", name=op.f("uq_configuration__key")),
51 )
52 op.create_index(
53 op.f("ix_configuration__key"), "configuration", ["key"], unique=False
54 )
55 op.create_index(
56 op.f("ix_configuration__updated"), "configuration", ["updated"], unique=False
57 )
58 # ### end Alembic commands ###
59
60
61def downgrade():
62 # ### commands auto generated by Alembic - please adjust! ###
63 op.drop_index(op.f("ix_configuration__updated"), table_name="configuration")
64 op.drop_index(op.f("ix_configuration__key"), table_name="configuration")
65 op.drop_table("configuration")
66 # ### end Alembic commands ###