[init] Add initial database migration files for PostgreSQL, SQLite, and MySQL
This commit is contained in:
27
api/migrations/mysql/001_init.down.sql
Normal file
27
api/migrations/mysql/001_init.down.sql
Normal 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;
|
Reference in New Issue
Block a user