didier/alembic/versions/c1f9ee875616_command_stats_...

55 lines
1.6 KiB
Python
Raw Permalink Normal View History

"""Command stats & GitHub links
2022-09-20 14:47:26 +02:00
Revision ID: c1f9ee875616
2022-09-20 14:47:26 +02:00
Revises: b84bb10fb8de
Create Date: 2022-09-20 17:18:02.289593
2022-09-20 14:47:26 +02:00
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "c1f9ee875616"
2022-09-20 14:47:26 +02:00
down_revision = "b84bb10fb8de"
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"command_stats",
sa.Column("command_stats_id", sa.Integer(), nullable=False),
sa.Column("command", sa.Text(), nullable=False),
sa.Column("timestamp", sa.DateTime(timezone=True), nullable=False),
sa.Column("user_id", sa.BigInteger(), nullable=True),
2022-09-20 14:47:26 +02:00
sa.Column("slash", sa.Boolean(), nullable=False),
sa.Column("context_menu", sa.Boolean(), nullable=False),
sa.ForeignKeyConstraint(
["user_id"],
["users.user_id"],
),
2022-09-20 14:47:26 +02:00
sa.PrimaryKeyConstraint("command_stats_id"),
)
op.create_table(
"github_links",
sa.Column("github_link_id", sa.Integer(), nullable=False),
sa.Column("url", sa.Text(), nullable=False),
sa.Column("user_id", sa.BigInteger(), nullable=True),
sa.ForeignKeyConstraint(
["user_id"],
["users.user_id"],
),
sa.PrimaryKeyConstraint("github_link_id"),
sa.UniqueConstraint("url"),
)
2022-09-20 14:47:26 +02:00
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("github_links")
2022-09-20 14:47:26 +02:00
op.drop_table("command_stats")
# ### end Alembic commands ###