mirror of
https://github.com/PaiGramTeam/MibooGram.git
synced 2024-11-23 00:01:33 +00:00
53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
|
"""history_data
|
||
|
|
||
|
Revision ID: 87c6195e5306
|
||
|
Revises: 369fb74daad9
|
||
|
Create Date: 2024-04-26 22:57:42.309397
|
||
|
|
||
|
"""
|
||
|
|
||
|
from alembic import op
|
||
|
import sqlalchemy as sa
|
||
|
|
||
|
# revision identifiers, used by Alembic.
|
||
|
revision = "87c6195e5306"
|
||
|
down_revision = "369fb74daad9"
|
||
|
branch_labels = None
|
||
|
depends_on = None
|
||
|
|
||
|
|
||
|
def upgrade() -> None:
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.create_table(
|
||
|
"history_data",
|
||
|
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
||
|
sa.Column("user_id", sa.BigInteger(), nullable=False),
|
||
|
sa.Column("data_id", sa.BigInteger(), nullable=True),
|
||
|
sa.Column(
|
||
|
"time_created",
|
||
|
sa.DateTime(),
|
||
|
server_default=sa.text("now()"),
|
||
|
nullable=True,
|
||
|
),
|
||
|
sa.Column("time_updated", sa.DateTime(), nullable=True),
|
||
|
sa.Column("type", sa.Integer(), nullable=False),
|
||
|
sa.Column("data", sa.JSON(), nullable=True),
|
||
|
sa.PrimaryKeyConstraint("id", "user_id", "type"),
|
||
|
mysql_charset="utf8mb4",
|
||
|
mysql_collate="utf8mb4_general_ci",
|
||
|
)
|
||
|
op.create_index(
|
||
|
op.f("ix_history_data_user_id"),
|
||
|
"history_data",
|
||
|
["user_id"],
|
||
|
unique=False,
|
||
|
)
|
||
|
# ### end Alembic commands ###
|
||
|
|
||
|
|
||
|
def downgrade() -> None:
|
||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
op.drop_index(op.f("ix_history_data_user_id"), table_name="history_data")
|
||
|
op.drop_table("history_data")
|
||
|
# ### end Alembic commands ###
|