CREATE TABLE IF NOT EXISTS "ls_list" (
	"id" serial PRIMARY KEY NOT NULL,
	"userId" varchar(255) NOT NULL,
	"title" varchar(128) NOT NULL,
	"variant" varchar NOT NULL,
	"labels" text,
	"showId" boolean DEFAULT false NOT NULL,
	"idPrefix" varchar(8),
	"lastTaskId" integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "ls_task" (
	"id" serial PRIMARY KEY NOT NULL,
	"listId" serial NOT NULL,
	"title" varchar(128) NOT NULL,
	"isChecked" boolean DEFAULT false NOT NULL,
	"visibleId" varchar(16),
	"label" varchar,
	"status" varchar,
	"priority" varchar
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "ls_account" (
	"user_id" varchar(255) NOT NULL,
	"type" varchar(255) NOT NULL,
	"provider" varchar(255) NOT NULL,
	"provider_account_id" varchar(255) NOT NULL,
	"refresh_token" text,
	"access_token" text,
	"expires_at" integer,
	"token_type" varchar(255),
	"scope" varchar(255),
	"id_token" text,
	"session_state" varchar(255),
	CONSTRAINT "ls_account_provider_provider_account_id_pk" PRIMARY KEY("provider","provider_account_id")
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "ls_session" (
	"session_token" varchar(255) PRIMARY KEY NOT NULL,
	"user_id" varchar(255) NOT NULL,
	"expires" timestamp with time zone NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "ls_user" (
	"id" varchar(255) PRIMARY KEY NOT NULL,
	"name" varchar(255),
	"email" varchar(255) NOT NULL,
	"email_verified" timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
	"image" varchar(255)
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "ls_verification_token" (
	"identifier" varchar(255) NOT NULL,
	"token" varchar(255) NOT NULL,
	"expires" timestamp with time zone NOT NULL,
	CONSTRAINT "ls_verification_token_identifier_token_pk" PRIMARY KEY("identifier","token")
);
--> statement-breakpoint
DO $$ BEGIN
 ALTER TABLE "ls_account" ADD CONSTRAINT "ls_account_user_id_ls_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."ls_user"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
 WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
 ALTER TABLE "ls_session" ADD CONSTRAINT "ls_session_user_id_ls_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."ls_user"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
 WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "account_user_id_idx" ON "ls_account" USING btree ("user_id");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "session_user_id_idx" ON "ls_session" USING btree ("user_id");