Docs: Consolidate admin documentation and migrate reference data
- Created LOCAL_DEVELOPMENT_GUIDE.md and DEPLOYMENT_GUIDE_MANUAL.md from legacy txt files. - Migrated country/time_zone data and requirements.txt to documentation/reference_data/. - Removed redundant admin/documentation/ and admin/data_files/ directories. - Enhanced app/lib_schema_v3.py to explicitly capture 'required' fields from DB 'NOT NULL' constraint. - Added verification tests for schema logic and standalone DB connectivity.
This commit is contained in:
56
tests/verify_schema_logic.py
Normal file
56
tests/verify_schema_logic.py
Normal file
@@ -0,0 +1,56 @@
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
import sqlalchemy
|
||||
from sqlalchemy import text
|
||||
|
||||
# Add current directory to path
|
||||
sys.path.append(os.getcwd())
|
||||
|
||||
# MUST BE FIRST: Mock app.config
|
||||
import tests.conftest_mock
|
||||
|
||||
# Connection details from .env (Bypassing app.config)
|
||||
DB_USER = "aether_dev"
|
||||
DB_PASS = "$1sky.AE_dev.2023"
|
||||
DB_SERVER = "vpn-db.oneskyit.com"
|
||||
DB_PORT = "3306"
|
||||
DB_NAME = "aether_dev"
|
||||
DB_URI = f"mysql://{DB_USER}:{DB_PASS}@{DB_SERVER}:{DB_PORT}/{DB_NAME}"
|
||||
|
||||
# Mock the db object before importing lib_schema_v3
|
||||
from app.db_sql import db
|
||||
db.engine = sqlalchemy.create_engine(DB_URI)
|
||||
|
||||
from app.lib_schema_v3 import get_object_schema_info
|
||||
|
||||
def verify_enhanced_schema():
|
||||
print("Testing enhanced get_object_schema_info for 'journal'...")
|
||||
try:
|
||||
info = get_object_schema_info("journal")
|
||||
|
||||
if "error" in info:
|
||||
print(f"Error: {info['error']}")
|
||||
return
|
||||
|
||||
cols = info["database"]["columns"]
|
||||
targets = ["name", "enable", "passcode_timeout", "created_on"]
|
||||
|
||||
print("\n--- Verified Enhanced Metadata ---")
|
||||
for col in cols:
|
||||
if col["field"] in targets:
|
||||
print(f"Field: {col['field']:16} | DB Type: {col['db_type']:15} | Required: {str(col['required']):5} | Default: {col['db_default']}")
|
||||
|
||||
# Basic check to ensure new keys exist
|
||||
assert "db_type" in cols[0]
|
||||
assert "required" in cols[0]
|
||||
assert "db_default" in cols[0]
|
||||
print("\nSuccess: New schema keys are present and populated.")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Test failed: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
if __name__ == "__main__":
|
||||
verify_enhanced_schema()
|
||||
Reference in New Issue
Block a user