migration.sql 756 B

12345678910111213141516
  1. PRAGMA foreign_keys=OFF;--> statement-breakpoint
  2. CREATE TABLE `__new_workspace` (
  3. `id` text PRIMARY KEY,
  4. `type` text NOT NULL,
  5. `name` text DEFAULT '' NOT NULL,
  6. `branch` text,
  7. `directory` text,
  8. `extra` text,
  9. `project_id` text NOT NULL,
  10. CONSTRAINT `fk_workspace_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE
  11. );
  12. --> statement-breakpoint
  13. INSERT INTO `__new_workspace`(`id`, `type`, `branch`, `name`, `directory`, `extra`, `project_id`) SELECT `id`, `type`, `branch`, `name`, `directory`, `extra`, `project_id` FROM `workspace`;--> statement-breakpoint
  14. DROP TABLE `workspace`;--> statement-breakpoint
  15. ALTER TABLE `__new_workspace` RENAME TO `workspace`;--> statement-breakpoint
  16. PRAGMA foreign_keys=ON;