{
    "success": true,
    "message": "Database analysis completed. See SQL statements for manual setup.",
    "tables_created": [
        "projects (needs creation)",
        "data_sources (needs creation)",
        "styles (needs creation)",
        "users (needs creation)",
        "tiles (needs creation)",
        "queue_items (needs creation)"
    ],
    "errors": [],
    "sql_statements": [
        "\n            CREATE OR REPLACE FUNCTION update_updated_at_column()\n            RETURNS TRIGGER AS $$\n            BEGIN\n                NEW.updated_at = NOW();\n                RETURN NEW;\n            END;\n            $$ language 'plpgsql';\n        ",
        "\n                CREATE TABLE IF NOT EXISTS projects (\n                    id BIGSERIAL PRIMARY KEY,\n                    name VARCHAR(255) NOT NULL,\n                    description TEXT,\n                    type VARCHAR(20) DEFAULT 'web' CHECK (type IN ('web', 'mobile', 'analysis')),\n                    created_at TIMESTAMPTZ DEFAULT NOW(),\n                    updated_at TIMESTAMPTZ DEFAULT NOW(),\n                    user_id BIGINT DEFAULT 1\n                );\n            ",
        "\n                CREATE TABLE IF NOT EXISTS data_sources (\n                    id BIGSERIAL PRIMARY KEY,\n                    project_id BIGINT REFERENCES projects(id) ON DELETE CASCADE,\n                    name VARCHAR(255) NOT NULL,\n                    filename VARCHAR(255) NOT NULL,\n                    type VARCHAR(50) NOT NULL,\n                    size BIGINT NOT NULL,\n                    uploaded_at TIMESTAMPTZ DEFAULT NOW()\n                );\n            ",
        "\n                CREATE TABLE IF NOT EXISTS styles (\n                    id BIGSERIAL PRIMARY KEY,\n                    project_id BIGINT REFERENCES projects(id) ON DELETE CASCADE,\n                    name VARCHAR(255) NOT NULL,\n                    style_json TEXT NOT NULL,\n                    created_at TIMESTAMPTZ DEFAULT NOW(),\n                    updated_at TIMESTAMPTZ DEFAULT NOW()\n                );\n            ",
        "\n                CREATE TABLE IF NOT EXISTS users (\n                    id BIGSERIAL PRIMARY KEY,\n                    username VARCHAR(100) UNIQUE NOT NULL,\n                    email VARCHAR(255) UNIQUE NOT NULL,\n                    password_hash VARCHAR(255),\n                    full_name VARCHAR(255),\n                    is_active BOOLEAN DEFAULT true,\n                    created_at TIMESTAMPTZ DEFAULT NOW(),\n                    updated_at TIMESTAMPTZ DEFAULT NOW()\n                );\n            ",
        "\n                CREATE TABLE IF NOT EXISTS tiles (\n                    id BIGSERIAL PRIMARY KEY,\n                    project_id BIGINT REFERENCES projects(id) ON DELETE CASCADE,\n                    x INTEGER NOT NULL,\n                    y INTEGER NOT NULL,\n                    z INTEGER NOT NULL,\n                    data BYTEA,\n                    content_type VARCHAR(100),\n                    created_at TIMESTAMPTZ DEFAULT NOW(),\n                    UNIQUE(project_id, x, y, z)\n                );\n            ",
        "\n                CREATE TABLE IF NOT EXISTS queue_items (\n                    id BIGSERIAL PRIMARY KEY,\n                    project_id BIGINT REFERENCES projects(id) ON DELETE CASCADE,\n                    filename VARCHAR(255) NOT NULL,\n                    status VARCHAR(50) DEFAULT 'pending' CHECK (status IN ('pending', 'processing', 'completed', 'failed')),\n                    error_message TEXT,\n                    created_at TIMESTAMPTZ DEFAULT NOW(),\n                    updated_at TIMESTAMPTZ DEFAULT NOW(),\n                    processed_at TIMESTAMPTZ\n                );\n            ",
        "\n            CREATE TRIGGER update_projects_updated_at \n                BEFORE UPDATE ON projects \n                FOR EACH ROW \n                EXECUTE FUNCTION update_updated_at_column();\n        ",
        "\n            CREATE TRIGGER update_styles_updated_at \n                BEFORE UPDATE ON styles \n                FOR EACH ROW \n                EXECUTE FUNCTION update_updated_at_column();\n        ",
        "\n            CREATE TRIGGER update_users_updated_at \n                BEFORE UPDATE ON users \n                FOR EACH ROW \n                EXECUTE FUNCTION update_updated_at_column();\n        ",
        "\n            CREATE TRIGGER update_queue_items_updated_at \n                BEFORE UPDATE ON queue_items \n                FOR EACH ROW \n                EXECUTE FUNCTION update_updated_at_column();\n        ",
        "CREATE INDEX IF NOT EXISTS idx_projects_user_id ON projects(user_id);",
        "CREATE INDEX IF NOT EXISTS idx_projects_type ON projects(type);",
        "CREATE INDEX IF NOT EXISTS idx_data_sources_project_id ON data_sources(project_id);",
        "CREATE INDEX IF NOT EXISTS idx_styles_project_id ON styles(project_id);",
        "CREATE INDEX IF NOT EXISTS idx_tiles_project_id ON tiles(project_id);",
        "CREATE INDEX IF NOT EXISTS idx_tiles_coords ON tiles(x, y, z);",
        "CREATE INDEX IF NOT EXISTS idx_queue_items_project_id ON queue_items(project_id);",
        "CREATE INDEX IF NOT EXISTS idx_queue_items_status ON queue_items(status);",
        "CREATE INDEX IF NOT EXISTS idx_users_username ON users(username);",
        "CREATE INDEX IF NOT EXISTS idx_users_email ON users(email);"
    ],
    "setup_method": "manual"
}