Skip to content

Commit ec02386

Browse files
committed
#208 merge db migrations
1 parent acda359 commit ec02386

9 files changed

Lines changed: 381 additions & 599 deletions

docs/DATABASE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ npm run db:migrate:run
7272

7373
Migrations are stored in `src/lib/server/migrations/`.
7474

75+
The current migration history is a single baseline migration. Existing databases
76+
created with the prior migration sequence must be reset before applying it.
77+
7578
## NPM Scripts
7679

7780
All Drizzle commands automatically load `.env.development` via `dotenv` in `drizzle.config.ts`.

src/lib/server/migrations/0000_calm_jimmy_woo.sql

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/lib/server/migrations/0002_dashing_nuke.sql renamed to src/lib/server/migrations/0000_initial_schema.sql

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
CREATE TABLE "user_storage_connections" (
2+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
3+
"user_id" text NOT NULL,
4+
"name" text NOT NULL,
5+
"encrypted_payload" text NOT NULL,
6+
"hash" text NOT NULL,
7+
"additional_buckets" jsonb DEFAULT '[]' NOT NULL,
8+
"created_at" timestamp DEFAULT now() NOT NULL,
9+
"updated_at" timestamp DEFAULT now() NOT NULL,
10+
CONSTRAINT "user_storage_connections_user_id_name_unique" UNIQUE("user_id","name")
11+
);
12+
--> statement-breakpoint
113
CREATE TABLE "account" (
214
"id" text PRIMARY KEY NOT NULL,
315
"account_id" text NOT NULL,
@@ -50,6 +62,7 @@ CREATE TABLE "verification" (
5062
--> statement-breakpoint
5163
ALTER TABLE "account" ADD CONSTRAINT "account_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
5264
ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
65+
CREATE INDEX "user_id_idx" ON "user_storage_connections" USING btree ("user_id");--> statement-breakpoint
5366
CREATE INDEX "account_userId_idx" ON "account" USING btree ("user_id");--> statement-breakpoint
5467
CREATE INDEX "session_userId_idx" ON "session" USING btree ("user_id");--> statement-breakpoint
55-
CREATE INDEX "verification_identifier_idx" ON "verification" USING btree ("identifier");
68+
CREATE INDEX "verification_identifier_idx" ON "verification" USING btree ("identifier");

src/lib/server/migrations/0001_add_unique_connection_name.sql

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/lib/server/migrations/0001_keen_prodigy.sql

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)