25 lines
715 B
Python
25 lines
715 B
Python
"""Migrate player_user table to remove player_id and make user_code unique globally."""
|
|
import sys
|
|
sys.path.insert(0, '/app')
|
|
|
|
from app.app import create_app
|
|
from app.extensions import db
|
|
from sqlalchemy import text
|
|
|
|
app = create_app('production')
|
|
|
|
with app.app_context():
|
|
print("Migrating player_user table...")
|
|
|
|
# Drop existing table and recreate with new schema
|
|
db.session.execute(text('DROP TABLE IF EXISTS player_user'))
|
|
db.session.commit()
|
|
|
|
# Create new table
|
|
db.create_all()
|
|
|
|
print("✓ player_user table migrated successfully!")
|
|
print(" - Removed player_id foreign key")
|
|
print(" - Made user_code unique globally")
|
|
print(" - user_name is now nullable")
|