-- ===========
--  Down Migration for 001_init
-- ===========

-- Drop indexes (reverse of creation order isn't required for indexes, but do before tables)
DROP INDEX IF EXISTS idx_routes_project_id;
DROP INDEX IF EXISTS idx_projects_workspace_id;
DROP INDEX IF EXISTS idx_workspaces_owner_id;

-- ===========
--  Product Logic (Projects & Routes)
-- ===========
DROP TABLE IF EXISTS routes;
DROP TABLE IF EXISTS projects;

-- ===========
--  RBAC (Roles & Permissions)
-- ===========
DROP TABLE IF EXISTS role_permissions;
DROP TABLE IF EXISTS permissions;
DROP TABLE IF EXISTS roles;

-- ===========
--  Tenancy (Workspaces & Members)
-- ===========
DROP TABLE IF EXISTS workspace_members;
DROP TABLE IF EXISTS workspaces;

-- ===========
--  Users & Plans
-- ===========
DROP TABLE IF EXISTS plans;
DROP TABLE IF EXISTS users;
