Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix: ensure tables are created only if they do not already exist

Andrej36e6cde61285
diff --git a/apps/api/drizzle/0000_deep_spot.sql b/apps/api/drizzle/0000_deep_spot.sql
index df4cfb633..75642c714 100644
--- a/apps/api/drizzle/0000_deep_spot.sql
+++ b/apps/api/drizzle/0000_deep_spot.sql
@@ -1,4 +1,4 @@
-CREATE TABLE `activity` (
+CREATE TABLE IF NOT EXISTS `activity` (
`id` text PRIMARY KEY NOT NULL,
`task_id` text NOT NULL,
`type` text NOT NULL,
@@ -9,7 +9,7 @@ CREATE TABLE `activity` (
FOREIGN KEY (`user_email`) REFERENCES `user`(`email`) ON UPDATE cascade ON DELETE cascade
);
--> statement-breakpoint
-CREATE TABLE `project` (
+CREATE TABLE IF NOT EXISTS `project` (
`id` text PRIMARY KEY NOT NULL,
`workspace_id` text NOT NULL,
`slug` text NOT NULL,
@@ -20,14 +20,14 @@ CREATE TABLE `project` (
FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE cascade ON DELETE cascade
);
--> statement-breakpoint
-CREATE TABLE `session` (
+CREATE TABLE IF NOT EXISTS `session` (
`id` text PRIMARY KEY NOT NULL,
`user_id` text NOT NULL,
`expires_at` integer NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE cascade ON DELETE cascade
);
--> statement-breakpoint
-CREATE TABLE `task` (
+CREATE TABLE IF NOT EXISTS `task` (
`id` text PRIMARY KEY NOT NULL,
`project_id` text NOT NULL,
`position` integer DEFAULT 0,
@@ -43,7 +43,7 @@ CREATE TABLE `task` (
FOREIGN KEY (`assignee_email`) REFERENCES `user`(`email`) ON UPDATE cascade ON DELETE cascade
);
--> statement-breakpoint
-CREATE TABLE `user` (
+CREATE TABLE IF NOT EXISTS `user` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`password` text NOT NULL,
@@ -51,8 +51,8 @@ CREATE TABLE `user` (
`created_at` integer DEFAULT '"2025-04-17T20:55:01.754Z"' NOT NULL
);
--> statement-breakpoint
-CREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`);--> statement-breakpoint
-CREATE TABLE `workspace` (
+CREATE UNIQUE INDEX IF NOT EXISTS `user_email_unique` ON `user` (`email`);--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS `workspace` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`description` text,
@@ -61,7 +61,7 @@ CREATE TABLE `workspace` (
FOREIGN KEY (`owner_email`) REFERENCES `user`(`email`) ON UPDATE cascade ON DELETE cascade
);
--> statement-breakpoint
-CREATE TABLE `workspace_member` (
+CREATE TABLE IF NOT EXISTS `workspace_member` (
`id` text PRIMARY KEY NOT NULL,
`workspace_id` text NOT NULL,
`user_email` text NOT NULL,