Initial commit: enterprise digital platform with portal SSO, DigiServer, IT Assets, NetworkView, Server Monitor
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""Add email field to https_config table."""
|
||||
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()
|
||||
|
||||
with app.app_context():
|
||||
print("Adding email column to https_config table...")
|
||||
|
||||
try:
|
||||
# Check if column already exists
|
||||
inspector = db.inspect(db.engine)
|
||||
columns = [col['name'] for col in inspector.get_columns('https_config')]
|
||||
|
||||
if 'email' not in columns:
|
||||
# Add the column
|
||||
with db.engine.connect() as conn:
|
||||
conn.execute(text('ALTER TABLE https_config ADD COLUMN email VARCHAR(255)'))
|
||||
conn.commit()
|
||||
print("✓ Email column added to https_config table!")
|
||||
else:
|
||||
print("✓ Email column already exists in https_config table.")
|
||||
|
||||
except Exception as e:
|
||||
print(f"ℹ️ Note: If table doesn't exist, run add_https_config_table.py first")
|
||||
print(f"Error details: {str(e)}")
|
||||
print("\nAlternatively, you can reset the database:")
|
||||
print(" rm instance/digiserver.db")
|
||||
print(" python migrations/add_https_config_table.py")
|
||||
@@ -0,0 +1,14 @@
|
||||
"""Add https_config table for HTTPS configuration management."""
|
||||
import sys
|
||||
sys.path.insert(0, '/app')
|
||||
|
||||
from app.app import create_app
|
||||
from app.extensions import db
|
||||
from app.models.https_config import HTTPSConfig
|
||||
|
||||
app = create_app()
|
||||
|
||||
with app.app_context():
|
||||
print("Creating https_config table...")
|
||||
db.create_all()
|
||||
print("✓ https_config table created successfully!")
|
||||
@@ -0,0 +1,14 @@
|
||||
"""Add player_user table for user code mappings."""
|
||||
import sys
|
||||
sys.path.insert(0, '/app')
|
||||
|
||||
from app.app import create_app
|
||||
from app.extensions import db
|
||||
from app.models.player_user import PlayerUser
|
||||
|
||||
app = create_app()
|
||||
|
||||
with app.app_context():
|
||||
print("Creating player_user table...")
|
||||
db.create_all()
|
||||
print("✓ player_user table created successfully!")
|
||||
@@ -0,0 +1,24 @@
|
||||
"""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")
|
||||
Reference in New Issue
Block a user