-- Current sql file was generated after introspecting the database
-- If you want to run this migration please uncomment this code before executing migrations
/*
CREATE TABLE IF NOT EXISTS "_prisma_migrations" (
	"id" varchar(36) PRIMARY KEY NOT NULL,
	"checksum" varchar(64) NOT NULL,
	"finished_at" timestamp with time zone,
	"migration_name" varchar(255) NOT NULL,
	"logs" text,
	"rolled_back_at" timestamp with time zone,
	"started_at" timestamp with time zone DEFAULT now() NOT NULL,
	"applied_steps_count" integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "User" (
	"id" serial PRIMARY KEY NOT NULL,
	"email" text NOT NULL,
	"name" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "Post" (
	"id" serial PRIMARY KEY NOT NULL,
	"createdAt" timestamp(3) DEFAULT CURRENT_TIMESTAMP NOT NULL,
	"updatedAt" timestamp(3) NOT NULL,
	"title" text,
	"content" text,
	"published" boolean DEFAULT false NOT NULL,
	"authorId" integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "Profile" (
	"id" serial PRIMARY KEY NOT NULL,
	"bio" text,
	"userId" integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "lipseycatalog" (
	"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "lipseycatalog_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
	"itemno" varchar(20) NOT NULL,
	"description1" text,
	"description2" text,
	"upc" varchar(20),
	"manufacturermodelno" varchar(30),
	"msrp" double precision,
	"model" text,
	"calibergauge" text,
	"manufacturer" text,
	"type" text,
	"action" text,
	"barrellength" text,
	"capacity" text,
	"finish" text,
	"overalllength" text,
	"receiver" text,
	"safety" text,
	"sights" text,
	"stockframegrips" text,
	"magazine" text,
	"weight" text,
	"imagename" text,
	"chamber" text,
	"drilledandtapped" text,
	"rateoftwist" text,
	"itemtype" text,
	"additionalfeature1" text,
	"additionalfeature2" text,
	"additionalfeature3" text,
	"shippingweight" text,
	"boundbookmanufacturer" text,
	"boundbookmodel" text,
	"boundbooktype" text,
	"nfathreadpattern" text,
	"nfaattachmentmethod" text,
	"nfabaffletype" text,
	"silencercanbedisassembled" text,
	"silencerconstructionmaterial" text,
	"nfadbreduction" text,
	"silenceroutsidediameter" text,
	"nfaform3caliber" text,
	"opticmagnification" text,
	"maintubesize" text,
	"adjustableobjective" text,
	"objectivesize" text,
	"opticadjustments" text,
	"illuminatedreticle" text,
	"reticle" text,
	"exclusive" text,
	"quantity" varchar(10) DEFAULT NULL,
	"allocated" text,
	"onsale" text,
	"price" double precision,
	"currentprice" double precision,
	"retailmap" double precision,
	"fflrequired" text,
	"sotrequired" text,
	"exclusivetype" text,
	"scopecoverincluded" text,
	"special" text,
	"sightstype" text,
	"case" text,
	"choke" text,
	"dbreduction" text,
	"family" text,
	"finishtype" text,
	"frame" text,
	"griptype" varchar(30),
	"handgunslidematerial" text,
	"countryoforigin" varchar(4),
	"itemlength" text,
	"itemwidth" text,
	"itemheight" text,
	"packagelength" double precision,
	"packagewidth" double precision,
	"packageheight" double precision,
	"itemgroup" varchar(40),
	"createdon" timestamp
);
--> statement-breakpoint
DO $$ BEGIN
 ALTER TABLE "Post" ADD CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "public"."User"("id") ON DELETE restrict ON UPDATE cascade;
EXCEPTION
 WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
 ALTER TABLE "Profile" ADD CONSTRAINT "Profile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE restrict ON UPDATE cascade;
EXCEPTION
 WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "User_email_key" ON "User" USING btree ("email" text_ops);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "User_id_idx" ON "User" USING btree ("id" int4_ops);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "Post_id_idx" ON "Post" USING btree ("id" int4_ops);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "Profile_id_idx" ON "Profile" USING btree ("id" int4_ops);--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "Profile_userId_key" ON "Profile" USING btree ("userId" int4_ops);
*/