Skip to content

Commit

Permalink
chore(app): recreate migrations and move db to /data
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcnk committed Feb 11, 2024
1 parent da7c973 commit 3e51d67
Show file tree
Hide file tree
Showing 11 changed files with 310 additions and 1,728 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PUBLIC_APP_URL=http://localhost:5173
SECRET_PLUNK_API_KEY=
SECRET_DB_DRIVER=turso
SECRET_SQLITE_URL=file:data/sqlite.db
SECRET_SQLITE_URL=file:./data/sqlite.db
SECRET_SQLITE_KEY=
Binary file modified bun.lockb
Binary file not shown.
3 changes: 3 additions & 0 deletions data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Data directory

This directory is mounted for 1-click deployments in Railway.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CREATE TABLE `access_token` (
`id` text PRIMARY KEY NOT NULL,
`internal` numeric DEFAULT 'true',
`name` text NOT NULL,
`user_id` text NOT NULL,
`created_at` text,
Expand All @@ -13,9 +14,10 @@ CREATE TABLE `board` (
`name` text NOT NULL,
`tag` text NOT NULL,
`options` text NOT NULL,
`events_order` text,
`created_at` text,
`updated_at` text,
FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE no action ON DELETE no action
FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `event` (
Expand All @@ -28,9 +30,13 @@ CREATE TABLE `event` (
`notify` numeric DEFAULT 'false',
`tags` text,
`context` text,
`priority` text DEFAULT 'normal' NOT NULL,
`assignee_id` text,
`due_date` text,
`created_at` text,
`updated_at` text,
FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE no action ON DELETE no action
FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`assignee_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `feature_flag` (
Expand All @@ -41,7 +47,7 @@ CREATE TABLE `feature_flag` (
`enabled` numeric DEFAULT 'false',
`created_at` text,
`updated_at` text,
FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE no action ON DELETE no action
FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `project` (
Expand All @@ -53,6 +59,14 @@ CREATE TABLE `project` (
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `project_invitation` (
`id` text PRIMARY KEY NOT NULL,
`user_id` text NOT NULL,
`project_id` text NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `user` (
`id` text PRIMARY KEY NOT NULL,
`email` text NOT NULL,
Expand Down Expand Up @@ -81,7 +95,7 @@ CREATE TABLE `users_to_projects` (
`project_id` text NOT NULL,
`role` text DEFAULT 'member' NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE no action ON DELETE no action
FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `verification_code` (
Expand All @@ -91,5 +105,16 @@ CREATE TABLE `verification_code` (
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `webhook` (
`id` text PRIMARY KEY NOT NULL,
`project_id` text NOT NULL,
`url` text NOT NULL,
`service` text NOT NULL,
`created_at` text,
`updated_at` text,
FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE UNIQUE INDEX `project_invitation_user_id_project_id_unique` ON `project_invitation` (`user_id`,`project_id`);--> statement-breakpoint
CREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`);--> statement-breakpoint
CREATE UNIQUE INDEX `user_username_unique` ON `user` (`username`);
28 changes: 0 additions & 28 deletions drizzle/0001_pale_loa.sql

This file was deleted.

24 changes: 0 additions & 24 deletions drizzle/0002_huge_hellfire_club.sql

This file was deleted.

Loading

0 comments on commit 3e51d67

Please sign in to comment.