21 lines
683 B
Python
21 lines
683 B
Python
"""号池记录账号加入时间,刷新时间继续用 saved_at。"""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "0005_account_created_at"
|
|
down_revision = "0004_worker_concurrency"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column("nqi_account", sa.Column("created_at", sa.DateTime(timezone=True), nullable=True))
|
|
op.execute("UPDATE nqi_account SET created_at = saved_at WHERE created_at IS NULL")
|
|
with op.batch_alter_table("nqi_account") as batch:
|
|
batch.alter_column("created_at", existing_type=sa.DateTime(timezone=True), nullable=False)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("nqi_account", "created_at")
|