feat: add avatar payments and finance management
This commit is contained in:
@@ -66,11 +66,18 @@ def init_db():
|
||||
("token_account", "total_consumed", "BIGINT DEFAULT 0"),
|
||||
("token_account", "created_at", "TIMESTAMP"),
|
||||
("token_account", "updated_at", "TIMESTAMP"),
|
||||
("token_plans", "virtual_product_id", "VARCHAR DEFAULT ''"),
|
||||
("token_payment_orders", "provider", "VARCHAR DEFAULT 'huihui'"),
|
||||
("token_payment_orders", "refund_status", "VARCHAR DEFAULT 'none'"),
|
||||
("token_payment_orders", "refunded_at", "TIMESTAMP"),
|
||||
("users", "wechat_mp_openid", "VARCHAR DEFAULT ''"),
|
||||
("users", "wechat_mp_session_key", "VARCHAR DEFAULT ''"),
|
||||
("takeover_messages", "attachment_id", "VARCHAR DEFAULT NULL"),
|
||||
)
|
||||
_normalize_optional_unique_values()
|
||||
_normalize_takeover_delays()
|
||||
_create_token_indexes()
|
||||
_create_payment_indexes()
|
||||
|
||||
|
||||
def _try_add_columns(*cols):
|
||||
@@ -104,3 +111,19 @@ def _create_token_indexes():
|
||||
"CREATE UNIQUE INDEX IF NOT EXISTS ux_token_account_user_id "
|
||||
"ON token_account(user_id) WHERE user_id <> ''"
|
||||
)
|
||||
|
||||
|
||||
def _create_payment_indexes():
|
||||
with engine.begin() as conn:
|
||||
conn.exec_driver_sql(
|
||||
"CREATE INDEX IF NOT EXISTS ix_token_payment_orders_provider "
|
||||
"ON token_payment_orders(provider)"
|
||||
)
|
||||
conn.exec_driver_sql(
|
||||
"CREATE INDEX IF NOT EXISTS ix_token_payment_orders_refund_status "
|
||||
"ON token_payment_orders(refund_status)"
|
||||
)
|
||||
conn.exec_driver_sql(
|
||||
"CREATE INDEX IF NOT EXISTS ix_users_wechat_mp_openid "
|
||||
"ON users(wechat_mp_openid)"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user