Changeset 0.6.0 (#36)
This commit is contained in:
@@ -90,13 +90,13 @@ echo " ✓ ${MIGRATION_COUNT} migrations applied"
|
||||
LATEST=$(psql -tAc "SELECT version FROM schema_migrations ORDER BY version DESC LIMIT 1;" 2>/dev/null || echo "none")
|
||||
echo " ✓ latest: ${LATEST}"
|
||||
|
||||
# ── 3. Core tables (001_full_schema) ─────────
|
||||
# ── 3. Core tables (001 schema, renamed in 006) ─
|
||||
echo ""
|
||||
echo "Core tables:"
|
||||
check_table "users"
|
||||
check_table "api_configs"
|
||||
check_table "chats"
|
||||
check_table "chat_messages"
|
||||
check_table "channels"
|
||||
check_table "messages"
|
||||
|
||||
# Key columns
|
||||
check_column "users" "id"
|
||||
@@ -105,9 +105,11 @@ check_column "users" "role"
|
||||
check_column "api_configs" "user_id"
|
||||
check_column "api_configs" "provider"
|
||||
check_column "api_configs" "api_key_encrypted"
|
||||
check_column "chats" "user_id"
|
||||
check_column "chat_messages" "chat_id"
|
||||
check_column "chat_messages" "role"
|
||||
check_column "channels" "user_id"
|
||||
check_column "channels" "type"
|
||||
check_column "messages" "channel_id"
|
||||
check_column "messages" "role"
|
||||
check_column "messages" "parent_id"
|
||||
|
||||
# ── 4. Refresh tokens (002) ─────────────────
|
||||
echo ""
|
||||
@@ -140,9 +142,44 @@ check_table "user_model_preferences"
|
||||
check_column "user_model_preferences" "user_id"
|
||||
check_column "user_model_preferences" "model_config_id"
|
||||
|
||||
# ── 8. Channel unification (006-008) ────────
|
||||
echo ""
|
||||
echo "Channel model (006-008):"
|
||||
check_column "channels" "description"
|
||||
check_column "messages" "participant_type"
|
||||
check_column "messages" "participant_id"
|
||||
check_table "channel_members"
|
||||
check_column "channel_members" "channel_id"
|
||||
check_column "channel_members" "user_id"
|
||||
check_table "channel_models"
|
||||
check_column "channel_models" "channel_id"
|
||||
check_column "channel_models" "model_id"
|
||||
check_table "channel_cursors"
|
||||
check_column "channel_cursors" "active_leaf_id"
|
||||
|
||||
# ── 9. Folders & Projects (009) ─────────────
|
||||
echo ""
|
||||
echo "Organization (009):"
|
||||
check_table "folders"
|
||||
check_column "folders" "user_id"
|
||||
check_table "projects"
|
||||
check_column "projects" "user_id"
|
||||
check_table "project_channels"
|
||||
|
||||
# ── 10. Banners (010) ───────────────────────
|
||||
echo ""
|
||||
echo "Banners (010):"
|
||||
# Banner config is seeded into global_settings; just verify the key exists
|
||||
BANNER_KEY=$(psql -tAc "SELECT 1 FROM global_settings WHERE key = 'banner';" 2>/dev/null || echo "0")
|
||||
if [[ "${BANNER_KEY}" == "1" ]]; then
|
||||
echo " ✓ global_settings: banner"
|
||||
else
|
||||
echo " ✗ MISSING global_settings key: banner"
|
||||
ERRORS=$((ERRORS + 1))
|
||||
fi
|
||||
|
||||
# ═══════════════════════════════════════════
|
||||
# ADD NEW MIGRATION CHECKS ABOVE THIS LINE
|
||||
# When you add migration 006, add checks here.
|
||||
# ═══════════════════════════════════════════
|
||||
|
||||
# ── Summary ──────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user