didier/alembic/versions/c1f9ee875616_command_stats_...

55 lines
1.6 KiB
Python

"""Command stats & GitHub links
Revision ID: c1f9ee875616
Revises: b84bb10fb8de
Create Date: 2022-09-20 17:18:02.289593
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "c1f9ee875616"
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),
sa.Column("slash", sa.Boolean(), nullable=False),
sa.Column("context_menu", sa.Boolean(), nullable=False),
sa.ForeignKeyConstraint(
["user_id"],
["users.user_id"],
),
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"),
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("github_links")
op.drop_table("command_stats")
# ### end Alembic commands ###