db: collapse migrations into a single baseline

Squash the incremental 0000–0004 migrations into one baseline generated from the
schema, which drizzle-kit confirms reproduces the current DB (26/26 tables, incl.
the hand-applied music_now_playing (user_id,device) PK and vault_tokens.client_id).
The Drizzle schema is the source of truth; this repo uses db:push, so a single
baseline is all that's needed to recreate the structure from scratch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-29 15:28:21 +00:00
co-authored by Claude Opus 4.8
parent 362b806c8a
commit 0325f14770
7 changed files with 593 additions and 3666 deletions
@@ -204,6 +204,69 @@ CREATE TABLE "pipeline_jobs" (
"completed_at" timestamp with time zone
);
--> statement-breakpoint
CREATE TABLE "chat_session_events" (
"id" bigserial PRIMARY KEY NOT NULL,
"session_id" text NOT NULL,
"event" jsonb NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "music_favorites" (
"id" serial PRIMARY KEY NOT NULL,
"user_id" integer NOT NULL,
"kind" text NOT NULL,
"key" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "uq_music_favorites_user_kind_key" UNIQUE("user_id","kind","key")
);
--> statement-breakpoint
CREATE TABLE "music_now_playing" (
"user_id" integer NOT NULL,
"device" text DEFAULT '' NOT NULL,
"home_path" text NOT NULL,
"dir" text DEFAULT '' NOT NULL,
"title" text DEFAULT '' NOT NULL,
"artist" text DEFAULT '' NOT NULL,
"album" text DEFAULT '' NOT NULL,
"duration_sec" real DEFAULT 0 NOT NULL,
"position_sec" real DEFAULT 0 NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "music_now_playing_user_id_device_pk" PRIMARY KEY("user_id","device")
);
--> statement-breakpoint
CREATE TABLE "music_playlist_items" (
"id" serial PRIMARY KEY NOT NULL,
"playlist_id" integer NOT NULL,
"key" text NOT NULL,
"position" integer NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "music_playlists" (
"id" serial PRIMARY KEY NOT NULL,
"user_id" integer NOT NULL,
"name" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "uq_music_playlists_user_name" UNIQUE("user_id","name")
);
--> statement-breakpoint
CREATE TABLE "vault_tokens" (
"user_id" integer PRIMARY KEY NOT NULL,
"access_token" text NOT NULL,
"refresh_token" text NOT NULL,
"expires_at" timestamp with time zone,
"device_identifier" text,
"client_id" text,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "vault_unlock_keys" (
"user_id" integer PRIMARY KEY NOT NULL,
"wrapped_key" text NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "passkey_challenges" ADD CONSTRAINT "passkey_challenges_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "passkeys" ADD CONSTRAINT "passkeys_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "dock_configs" ADD CONSTRAINT "dock_configs_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
@@ -220,9 +283,18 @@ ALTER TABLE "task_logs" ADD CONSTRAINT "task_logs_user_id_users_id_fk" FOREIGN K
ALTER TABLE "terminal_containers" ADD CONSTRAINT "terminal_containers_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "email_accounts" ADD CONSTRAINT "email_accounts_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "pipeline_jobs" ADD CONSTRAINT "pipeline_jobs_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "music_favorites" ADD CONSTRAINT "music_favorites_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "music_now_playing" ADD CONSTRAINT "music_now_playing_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "music_playlist_items" ADD CONSTRAINT "music_playlist_items_playlist_id_music_playlists_id_fk" FOREIGN KEY ("playlist_id") REFERENCES "public"."music_playlists"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "music_playlists" ADD CONSTRAINT "music_playlists_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "vault_tokens" ADD CONSTRAINT "vault_tokens_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "vault_unlock_keys" ADD CONSTRAINT "vault_unlock_keys_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "idx_token_blacklist_expires" ON "token_blacklist" USING btree ("expires_at");--> statement-breakpoint
CREATE INDEX "idx_queue_jobs_status_lane" ON "queue_jobs" USING btree ("status","lane");--> statement-breakpoint
CREATE INDEX "idx_queue_jobs_user" ON "queue_jobs" USING btree ("user_id");--> statement-breakpoint
CREATE INDEX "idx_task_logs_user_started" ON "task_logs" USING btree ("user_id","started_at");--> statement-breakpoint
CREATE INDEX "idx_pipeline_jobs_user_created" ON "pipeline_jobs" USING btree ("user_id","created_at");--> statement-breakpoint
CREATE INDEX "idx_pipeline_jobs_status" ON "pipeline_jobs" USING btree ("status");
CREATE INDEX "idx_pipeline_jobs_status" ON "pipeline_jobs" USING btree ("status");--> statement-breakpoint
CREATE INDEX "idx_chat_session_events_session_id" ON "chat_session_events" USING btree ("session_id","id");--> statement-breakpoint
CREATE INDEX "idx_music_favorites_user_kind" ON "music_favorites" USING btree ("user_id","kind");--> statement-breakpoint
CREATE INDEX "idx_music_playlist_items_playlist" ON "music_playlist_items" USING btree ("playlist_id","position");
@@ -1,8 +0,0 @@
CREATE TABLE "chat_session_events" (
"id" bigserial PRIMARY KEY NOT NULL,
"session_id" text NOT NULL,
"event" jsonb NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE INDEX "idx_chat_session_events_session_id" ON "chat_session_events" USING btree ("session_id","id");
@@ -1,44 +0,0 @@
CREATE TABLE "music_favorites" (
"id" serial PRIMARY KEY NOT NULL,
"user_id" integer NOT NULL,
"kind" text NOT NULL,
"key" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "uq_music_favorites_user_kind_key" UNIQUE("user_id","kind","key")
);
--> statement-breakpoint
CREATE TABLE "music_now_playing" (
"user_id" integer PRIMARY KEY NOT NULL,
"home_path" text NOT NULL,
"dir" text DEFAULT '' NOT NULL,
"title" text DEFAULT '' NOT NULL,
"artist" text DEFAULT '' NOT NULL,
"album" text DEFAULT '' NOT NULL,
"duration_sec" real DEFAULT 0 NOT NULL,
"position_sec" real DEFAULT 0 NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "music_playlist_items" (
"id" serial PRIMARY KEY NOT NULL,
"playlist_id" integer NOT NULL,
"key" text NOT NULL,
"position" integer NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "music_playlists" (
"id" serial PRIMARY KEY NOT NULL,
"user_id" integer NOT NULL,
"name" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "uq_music_playlists_user_name" UNIQUE("user_id","name")
);
--> statement-breakpoint
ALTER TABLE "music_favorites" ADD CONSTRAINT "music_favorites_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "music_now_playing" ADD CONSTRAINT "music_now_playing_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "music_playlist_items" ADD CONSTRAINT "music_playlist_items_playlist_id_music_playlists_id_fk" FOREIGN KEY ("playlist_id") REFERENCES "public"."music_playlists"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "music_playlists" ADD CONSTRAINT "music_playlists_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "idx_music_favorites_user_kind" ON "music_favorites" USING btree ("user_id","kind");--> statement-breakpoint
CREATE INDEX "idx_music_playlist_items_playlist" ON "music_playlist_items" USING btree ("playlist_id","position");
@@ -1,5 +1,5 @@
{
"id": "251f147c-5aeb-41e8-8f24-8a6e2892eaeb",
"id": "4bd8f78b-a206-4605-a676-6bb120a1c8ec",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
@@ -1559,6 +1559,523 @@
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.chat_session_events": {
"name": "chat_session_events",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "bigserial",
"primaryKey": true,
"notNull": true
},
"session_id": {
"name": "session_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"event": {
"name": "event",
"type": "jsonb",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"idx_chat_session_events_session_id": {
"name": "idx_chat_session_events_session_id",
"columns": [
{
"expression": "session_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.music_favorites": {
"name": "music_favorites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"kind": {
"name": "kind",
"type": "text",
"primaryKey": false,
"notNull": true
},
"key": {
"name": "key",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"idx_music_favorites_user_kind": {
"name": "idx_music_favorites_user_kind",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "kind",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"music_favorites_user_id_users_id_fk": {
"name": "music_favorites_user_id_users_id_fk",
"tableFrom": "music_favorites",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"uq_music_favorites_user_kind_key": {
"name": "uq_music_favorites_user_kind_key",
"nullsNotDistinct": false,
"columns": [
"user_id",
"kind",
"key"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.music_now_playing": {
"name": "music_now_playing",
"schema": "",
"columns": {
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"device": {
"name": "device",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "''"
},
"home_path": {
"name": "home_path",
"type": "text",
"primaryKey": false,
"notNull": true
},
"dir": {
"name": "dir",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "''"
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "''"
},
"artist": {
"name": "artist",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "''"
},
"album": {
"name": "album",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "''"
},
"duration_sec": {
"name": "duration_sec",
"type": "real",
"primaryKey": false,
"notNull": true,
"default": 0
},
"position_sec": {
"name": "position_sec",
"type": "real",
"primaryKey": false,
"notNull": true,
"default": 0
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"music_now_playing_user_id_users_id_fk": {
"name": "music_now_playing_user_id_users_id_fk",
"tableFrom": "music_now_playing",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"music_now_playing_user_id_device_pk": {
"name": "music_now_playing_user_id_device_pk",
"columns": [
"user_id",
"device"
]
}
},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.music_playlist_items": {
"name": "music_playlist_items",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"playlist_id": {
"name": "playlist_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"key": {
"name": "key",
"type": "text",
"primaryKey": false,
"notNull": true
},
"position": {
"name": "position",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"idx_music_playlist_items_playlist": {
"name": "idx_music_playlist_items_playlist",
"columns": [
{
"expression": "playlist_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "position",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"music_playlist_items_playlist_id_music_playlists_id_fk": {
"name": "music_playlist_items_playlist_id_music_playlists_id_fk",
"tableFrom": "music_playlist_items",
"tableTo": "music_playlists",
"columnsFrom": [
"playlist_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.music_playlists": {
"name": "music_playlists",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"music_playlists_user_id_users_id_fk": {
"name": "music_playlists_user_id_users_id_fk",
"tableFrom": "music_playlists",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"uq_music_playlists_user_name": {
"name": "uq_music_playlists_user_name",
"nullsNotDistinct": false,
"columns": [
"user_id",
"name"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.vault_tokens": {
"name": "vault_tokens",
"schema": "",
"columns": {
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": true,
"notNull": true
},
"access_token": {
"name": "access_token",
"type": "text",
"primaryKey": false,
"notNull": true
},
"refresh_token": {
"name": "refresh_token",
"type": "text",
"primaryKey": false,
"notNull": true
},
"expires_at": {
"name": "expires_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"device_identifier": {
"name": "device_identifier",
"type": "text",
"primaryKey": false,
"notNull": false
},
"client_id": {
"name": "client_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"vault_tokens_user_id_users_id_fk": {
"name": "vault_tokens_user_id_users_id_fk",
"tableFrom": "vault_tokens",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.vault_unlock_keys": {
"name": "vault_unlock_keys",
"schema": "",
"columns": {
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": true,
"notNull": true
},
"wrapped_key": {
"name": "wrapped_key",
"type": "text",
"primaryKey": false,
"notNull": true
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"vault_unlock_keys_user_id_users_id_fk": {
"name": "vault_unlock_keys_user_id_users_id_fk",
"tableFrom": "vault_unlock_keys",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -5,22 +5,8 @@
{
"idx": 0,
"version": "7",
"when": 1785018112373,
"tag": "0000_eager_sir_ram",
"breakpoints": true
},
{
"idx": 1,
"version": "7",
"when": 1785110579165,
"tag": "0001_omniscient_photon",
"breakpoints": true
},
{
"idx": 2,
"version": "7",
"when": 1785198942654,
"tag": "0002_gray_killmonger",
"when": 1785338790645,
"tag": "0000_crazy_elektra",
"breakpoints": true
}
]