#!/usr/bin/env python3 import json # Load system_tables.json with open('backend/internal/bootstrap/system_tables.json') as f: tables = json.load(f) print(f"Total tables: {len(tables)}") # Show a few table examples with their DDL def generate_ddl(table): cols = [] for c in table.get('columns', []): col_type = c.get('type', 'VARCHAR(255)') col_name = c.get('name', '') nullable = c.get('nullable', False) default = c.get('default') unique = c.get('unique', False) auto_inc = c.get('autoIncrement', False) primary = c.get('primaryKey', False) parts = ['`{}`'.format(col_name), col_type] if not nullable: parts.append('NOT NULL') if default is not None: parts.append('DEFAULT {}'.format(default)) if unique: parts.append('UNIQUE') if auto_inc: parts.append('AUTO_INCREMENT') if primary: parts.append('PRIMARY KEY') cols.append(' '.join(parts)) ddl = 'CREATE TABLE IF NOT EXISTS `{}` (\n {}\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;'.format( table['tableName'], ',\n '.join(cols)) return ddl # Show first 3 tables for t in tables[:3]: print(f"\n=== {t['tableName']} ===") print(generate_ddl(t)[:500])