-- ============================================================================
--  Combined installer — runs all three schemas against ONE shared database.
--  Tables stay name-spaced by prefix (intake_*, chatbot_*, htc_*) so the
--  three apps never collide.
--
--  From CLI:
--      mysql -u root -p < sql/install_all.sql
--
--  Or from inside MySQL:
--      SOURCE sql/install_all.sql;
-- ============================================================================

CREATE DATABASE IF NOT EXISTS clinics_db
  CHARACTER SET utf8mb4
  COLLATE utf8mb4_unicode_ci;

USE clinics_db;

SOURCE ../intake_form/sql/schema.sql;
SOURCE ../chatbot/sql/schema.sql;
SOURCE ../chatbot_healththerapies/sql/schema.sql;
SOURCE ../chatbot_lanecoveacupuncture/sql/schema.sql;

-- Sanity check
SELECT TABLE_SCHEMA, COUNT(*) AS table_count
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'clinics_db'
GROUP BY TABLE_SCHEMA;
