[init] Add initial database migration files for PostgreSQL, SQLite, and MySQL

This commit is contained in:
2025-08-23 19:46:51 +02:00
parent df6d7c7db2
commit 0949b1e7f5
6 changed files with 479 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
-- Down migration for 001_init
START TRANSACTION;
-- Disable FK checks to avoid dependency issues during drops
SET FOREIGN_KEY_CHECKS = 0;
-- Drop indexes (will be removed automatically with tables, but explicit drops keep intent clear)
DROP INDEX idx_routes_project_id ON routes;
DROP INDEX idx_projects_workspace_id ON projects;
DROP INDEX idx_workspaces_owner_id ON workspaces;
-- Drop tables in reverse dependency order
DROP TABLE IF EXISTS role_permissions;
DROP TABLE IF EXISTS workspace_members;
DROP TABLE IF EXISTS routes;
DROP TABLE IF EXISTS projects;
DROP TABLE IF EXISTS permissions;
DROP TABLE IF EXISTS roles;
DROP TABLE IF EXISTS workspaces;
DROP TABLE IF EXISTS plans;
DROP TABLE IF EXISTS users;
-- Re-enable FK checks
SET FOREIGN_KEY_CHECKS = 1;
COMMIT;