fix: remove duplicate statements from migration 0004 and orphan migration file
Migration 0004 contained CREATE TABLE and ALTER TABLE statements already applied in migrations 0002 and 0003, causing PGlite test DB initialization to fail (311 test failures). Stripped to only the new dominant_color and crop_* columns. Also removed orphan 0000_fuzzy_shiva.sql. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,133 +0,0 @@
|
||||
CREATE TABLE "api_keys" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"key_hash" text NOT NULL,
|
||||
"key_prefix" text NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "categories" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"icon" text DEFAULT 'package' NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "categories_name_unique" UNIQUE("name")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "items" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"weight_grams" double precision,
|
||||
"price_cents" integer,
|
||||
"category_id" integer NOT NULL,
|
||||
"notes" text,
|
||||
"product_url" text,
|
||||
"image_filename" text,
|
||||
"image_source_url" text,
|
||||
"quantity" integer DEFAULT 1 NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "oauth_clients" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"client_id" text NOT NULL,
|
||||
"client_name" text,
|
||||
"redirect_uris" text NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "oauth_clients_client_id_unique" UNIQUE("client_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "oauth_codes" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"code" text NOT NULL,
|
||||
"client_id" text NOT NULL,
|
||||
"code_challenge" text NOT NULL,
|
||||
"code_challenge_method" text DEFAULT 'S256' NOT NULL,
|
||||
"redirect_uri" text NOT NULL,
|
||||
"expires_at" timestamp NOT NULL,
|
||||
"used" boolean DEFAULT false NOT NULL,
|
||||
CONSTRAINT "oauth_codes_code_unique" UNIQUE("code")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "oauth_tokens" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"access_token_hash" text NOT NULL,
|
||||
"refresh_token_hash" text NOT NULL,
|
||||
"client_id" text NOT NULL,
|
||||
"expires_at" timestamp NOT NULL,
|
||||
"refresh_expires_at" timestamp NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "oauth_tokens_access_token_hash_unique" UNIQUE("access_token_hash"),
|
||||
CONSTRAINT "oauth_tokens_refresh_token_hash_unique" UNIQUE("refresh_token_hash")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "sessions" (
|
||||
"id" text PRIMARY KEY NOT NULL,
|
||||
"user_id" integer NOT NULL,
|
||||
"expires_at" timestamp NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "settings" (
|
||||
"key" text PRIMARY KEY NOT NULL,
|
||||
"value" text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "setup_items" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"setup_id" integer NOT NULL,
|
||||
"item_id" integer NOT NULL,
|
||||
"classification" text DEFAULT 'base' NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "setups" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "thread_candidates" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"thread_id" integer NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"weight_grams" double precision,
|
||||
"price_cents" integer,
|
||||
"category_id" integer NOT NULL,
|
||||
"notes" text,
|
||||
"product_url" text,
|
||||
"image_filename" text,
|
||||
"image_source_url" text,
|
||||
"status" text DEFAULT 'researching' NOT NULL,
|
||||
"pros" text,
|
||||
"cons" text,
|
||||
"sort_order" double precision DEFAULT 0 NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "threads" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"status" text DEFAULT 'active' NOT NULL,
|
||||
"resolved_candidate_id" integer,
|
||||
"category_id" integer NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "users" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"username" text NOT NULL,
|
||||
"password_hash" text NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "users_username_unique" UNIQUE("username")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "items" ADD CONSTRAINT "items_category_id_categories_id_fk" FOREIGN KEY ("category_id") REFERENCES "public"."categories"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "sessions" ADD CONSTRAINT "sessions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "setup_items" ADD CONSTRAINT "setup_items_setup_id_setups_id_fk" FOREIGN KEY ("setup_id") REFERENCES "public"."setups"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "setup_items" ADD CONSTRAINT "setup_items_item_id_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "thread_candidates" ADD CONSTRAINT "thread_candidates_thread_id_threads_id_fk" FOREIGN KEY ("thread_id") REFERENCES "public"."threads"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "thread_candidates" ADD CONSTRAINT "thread_candidates_category_id_categories_id_fk" FOREIGN KEY ("category_id") REFERENCES "public"."categories"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "threads" ADD CONSTRAINT "threads_category_id_categories_id_fk" FOREIGN KEY ("category_id") REFERENCES "public"."categories"("id") ON DELETE no action ON UPDATE no action;
|
||||
@@ -1,12 +1,3 @@
|
||||
CREATE TABLE "global_item_tags" (
|
||||
"global_item_id" integer NOT NULL,
|
||||
"tag_id" integer NOT NULL,
|
||||
CONSTRAINT "global_item_tags_global_item_id_tag_id_pk" PRIMARY KEY("global_item_id","tag_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "global_items" ADD COLUMN "source_url" text;--> statement-breakpoint
|
||||
ALTER TABLE "global_items" ADD COLUMN "image_credit" text;--> statement-breakpoint
|
||||
ALTER TABLE "global_items" ADD COLUMN "image_source_url" text;--> statement-breakpoint
|
||||
ALTER TABLE "global_items" ADD COLUMN "dominant_color" text;--> statement-breakpoint
|
||||
ALTER TABLE "global_items" ADD COLUMN "crop_zoom" double precision;--> statement-breakpoint
|
||||
ALTER TABLE "global_items" ADD COLUMN "crop_x" double precision;--> statement-breakpoint
|
||||
@@ -15,14 +6,7 @@ ALTER TABLE "items" ADD COLUMN "dominant_color" text;--> statement-breakpoint
|
||||
ALTER TABLE "items" ADD COLUMN "crop_zoom" double precision;--> statement-breakpoint
|
||||
ALTER TABLE "items" ADD COLUMN "crop_x" double precision;--> statement-breakpoint
|
||||
ALTER TABLE "items" ADD COLUMN "crop_y" double precision;--> statement-breakpoint
|
||||
ALTER TABLE "oauth_codes" ADD COLUMN "user_id" integer NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "thread_candidates" ADD COLUMN "dominant_color" text;--> statement-breakpoint
|
||||
ALTER TABLE "thread_candidates" ADD COLUMN "crop_zoom" double precision;--> statement-breakpoint
|
||||
ALTER TABLE "thread_candidates" ADD COLUMN "crop_x" double precision;--> statement-breakpoint
|
||||
ALTER TABLE "thread_candidates" ADD COLUMN "crop_y" double precision;--> statement-breakpoint
|
||||
ALTER TABLE "global_item_tags" ADD CONSTRAINT "global_item_tags_global_item_id_global_items_id_fk" FOREIGN KEY ("global_item_id") REFERENCES "public"."global_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "global_item_tags" ADD CONSTRAINT "global_item_tags_tag_id_tags_id_fk" FOREIGN KEY ("tag_id") REFERENCES "public"."tags"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "items" ADD CONSTRAINT "items_global_item_id_global_items_id_fk" FOREIGN KEY ("global_item_id") REFERENCES "public"."global_items"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "oauth_codes" ADD CONSTRAINT "oauth_codes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "thread_candidates" ADD CONSTRAINT "thread_candidates_global_item_id_global_items_id_fk" FOREIGN KEY ("global_item_id") REFERENCES "public"."global_items"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "global_items" ADD CONSTRAINT "global_items_brand_model_unique" UNIQUE("brand","model");
|
||||
ALTER TABLE "thread_candidates" ADD COLUMN "crop_y" double precision;
|
||||
Reference in New Issue
Block a user