DROP TABLE IF EXISTS "public"."Luv2_promo";
CREATE TABLE "public"."Luv2_promo" (
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "id_pricelist" int2 DEFAULT 0,
  "name" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "info" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "from_date" date,
  "to_date" date,
  "active" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'Y'::character varying,
  "deleted" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'N'::character varying,
  "id_company" int4 NOT NULL DEFAULT 0,
  "tipe" int2 DEFAULT 0,
  "benefit" int2 DEFAULT 0,
  "date" date,
  "benefit_disc" numeric DEFAULT 0,
  "benefit_price" numeric DEFAULT 0,
  "qty_pack" numeric(10,2) DEFAULT 0,
  "value_pack" numeric(10,2) DEFAULT 0
)
;
CREATE INDEX "promo_from_date" ON "public"."Luv2_promo" USING btree (
  "from_date" "pg_catalog"."date_ops" ASC NULLS LAST
);
CREATE INDEX "promo_id_company" ON "public"."Luv2_promo" USING btree (
  "id_company" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "promo_id_pricelist" ON "public"."Luv2_promo" USING btree (
  "id_pricelist" "pg_catalog"."int2_ops" ASC NULLS LAST
);
CREATE INDEX "promo_name" ON "public"."Luv2_promo" USING btree (
  "name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_no" ON "public"."Luv2_promo" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_tipe" ON "public"."Luv2_promo" USING btree (
  "tipe" "pg_catalog"."int2_ops" ASC NULLS LAST
);
CREATE INDEX "promo_tipe2" ON "public"."Luv2_promo" USING btree (
  "benefit" "pg_catalog"."int2_ops" ASC NULLS LAST
);
CREATE INDEX "promo_to_date" ON "public"."Luv2_promo" USING btree (
  "to_date" "pg_catalog"."date_ops" ASC NULLS LAST
);
ALTER TABLE "public"."Luv2_promo" ADD CONSTRAINT "Luv2_promo_pkey" PRIMARY KEY ("no", "id_company");

DROP TABLE IF EXISTS "public"."Luv2_promo_item";
CREATE TABLE "public"."Luv2_promo_item" (
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "id_company" int4 NOT NULL DEFAULT 0,
  "item_code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "disc" numeric DEFAULT 0,
  "disc_price" numeric DEFAULT 0,
  "pack" int2 NOT NULL DEFAULT 0
)
;

CREATE INDEX "promo_item_id_company" ON "public"."Luv2_promo_item" USING btree (
  "id_company" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_item_code" ON "public"."Luv2_promo_item" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_no" ON "public"."Luv2_promo_item" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_pack" ON "public"."Luv2_promo_item" USING btree (
  "pack" "pg_catalog"."int2_ops" ASC NULLS LAST
);

ALTER TABLE "public"."Luv2_promo_item" ADD CONSTRAINT "Luv2_promo_item_pkey" PRIMARY KEY ("no", "id_company", "item_code", "pack");

DROP TABLE IF EXISTS "public"."Luv2_promo_item_qty";
CREATE TABLE "public"."Luv2_promo_item_qty" (
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "id_company" int4 NOT NULL DEFAULT 0,
  "item_code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "qty" numeric NOT NULL DEFAULT 0,
  "disc" numeric DEFAULT 0,
  "disc_price" numeric DEFAULT 0
)
;

CREATE INDEX "promo_item_qty_id_company" ON "public"."Luv2_promo_item_qty" USING btree (
  "id_company" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_qty_item_code" ON "public"."Luv2_promo_item_qty" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_qty_no" ON "public"."Luv2_promo_item_qty" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

ALTER TABLE "public"."Luv2_promo_item_qty" ADD CONSTRAINT "Luv2_promo_item_qty_pkey" PRIMARY KEY ("no", "id_company", "item_code", "qty");

DROP TABLE IF EXISTS "public"."Luv2_promo_item_gwp";
CREATE TABLE "public"."Luv2_promo_item_gwp" (
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL,
  "id_company" int4 NOT NULL DEFAULT 0,
  "item_code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "item_barcode" varchar(225) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "item_name" varchar(100) COLLATE "pg_catalog"."default" DEFAULT ''::character varying
)
;

CREATE INDEX "promo_item_gwp_id_company" ON "public"."Luv2_promo_item_gwp" USING btree (
  "id_company" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_item_barcode" ON "public"."Luv2_promo_item_gwp" USING btree (
  "item_barcode" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_item_code" ON "public"."Luv2_promo_item_gwp" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_item_name" ON "public"."Luv2_promo_item_gwp" USING btree (
  "item_name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_no" ON "public"."Luv2_promo_item_gwp" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

ALTER TABLE "public"."Luv2_promo_item_gwp" ADD CONSTRAINT "Luv2_promo_item_gwp_temp_copy1_pkey" PRIMARY KEY ("no", "id_company", "item_code");

DROP TABLE IF EXISTS "public"."Luv2_promo_item_gwp_temp";
CREATE TABLE "public"."Luv2_promo_item_gwp_temp" (
  "id_company" int4 NOT NULL DEFAULT 0,
  "id_user" int4 NOT NULL DEFAULT 0,
  "item_code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "item_barcode" varchar(225) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "item_name" varchar(100) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL

)
;

CREATE INDEX "promo_item_gwp_temp_id_company" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "id_company" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_temp_id_user" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "id_user" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_temp_item_barcode" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "item_barcode" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_temp_item_code" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_temp_item_name" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "item_name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

ALTER TABLE "public"."Luv2_promo_item_gwp_temp" ADD CONSTRAINT "Luv2_promo_item_gwp_temp_pkey" PRIMARY KEY ("id_company", "id_user", "item_code");


ALTER TABLE "public"."Luv2_carts" 
  ADD COLUMN "promo" varchar(12),
  ADD COLUMN "promo_tipe" int2;

ALTER TABLE "public"."Luv2_detailinvoice" 
  ADD COLUMN "promo" varchar(12),
  ADD COLUMN "promo_tipe" int2;

ALTER TABLE "public"."Luv2_invoice" 
  ADD COLUMN "promo" varchar(12);

ALTER TABLE "public"."Luv2_detailinvoice" 
  ADD COLUMN "pack" int2 DEFAULT 0;

ALTER TABLE "public"."Luv2_carts" 
  ADD COLUMN "pack" int2 DEFAULT 0;

ALTER TABLE "public"."Luv2_carts" 
  ALTER COLUMN "price" TYPE varchar(255) COLLATE "pg_catalog"."default";

ALTER TABLE "public"."Luv2_detailinvoice" 
DROP CONSTRAINT "Luv2_detailinvoice_pkey";

UPDATE "public"."Luv2_detailinvoice"
SET "promo" = 0
WHERE "promo" IS NULL;

ALTER TABLE "public"."Luv2_detailinvoice" 
ALTER COLUMN "promo" SET NOT NULL,
ALTER COLUMN "promo" SET DEFAULT 0;

ALTER TABLE "public"."Luv2_detailinvoice" 
ADD CONSTRAINT "Luv2_detailinvoice_pkey" PRIMARY KEY ("invoice", "code", "status", "linenum", "pack", "promo");


ALTER TABLE "public"."Luv2_invoice" 
  ALTER COLUMN "promo" SET DEFAULT 0;

ALTER TABLE "public"."Luv2_carts" 
  ADD COLUMN "benefit" varchar(50) DEFAULT 'N';

ALTER TABLE "public"."Luv2_detailinvoice" 
  ADD COLUMN "benefit" varchar(50) DEFAULT 'N';

ALTER TABLE "public"."Luv2_detailinvoice" 
  ADD COLUMN "benefit" varchar(50) NOT NULL DEFAULT 'N';

ALTER TABLE "public"."Luv2_promo" RENAME COLUMN "benefit_disc" TO "disc";

ALTER TABLE "public"."Luv2_promo" RENAME COLUMN "benefit_price" TO "disc_price";

ALTER TABLE "public"."Luv2_promo" 
  DROP COLUMN "info",
  DROP COLUMN "active",
  ADD COLUMN "voucher_from_date" date,
  ADD COLUMN "voucher_to_date" date,
  ADD COLUMN "voucher" numeric DEFAULT 0;

  ALTER TABLE "public"."Luv2_carts" 
  ADD COLUMN "promo" varchar(12),
  ADD COLUMN "promo_tipe" int2;

ALTER TABLE "public"."Luv2_detailinvoice" 
  ADD COLUMN "promo" varchar(12),
  ADD COLUMN "promo_tipe" int2;

ALTER TABLE "public"."Luv2_invoice" 
  ADD COLUMN "promo" varchar(12);

ALTER TABLE "public"."Luv2_detailinvoice" 
  ADD COLUMN "pack" int2 DEFAULT 0;

ALTER TABLE "public"."Luv2_carts" 
  ADD COLUMN "pack" int2 DEFAULT 0;

ALTER TABLE "public"."Luv2_carts" 
  ALTER COLUMN "price" TYPE varchar(255) COLLATE "pg_catalog"."default";

ALTER TABLE "public"."Luv2_detailinvoice" 
DROP CONSTRAINT "Luv2_detailinvoice_pkey";

UPDATE "public"."Luv2_detailinvoice"
SET "promo" = 0
WHERE "promo" IS NULL;

ALTER TABLE "public"."Luv2_detailinvoice" 
ALTER COLUMN "promo" SET NOT NULL,
ALTER COLUMN "promo" SET DEFAULT 0;

ALTER TABLE "public"."Luv2_detailinvoice" 
ADD CONSTRAINT "Luv2_detailinvoice_pkey" PRIMARY KEY ("invoice", "code", "status", "linenum", "pack", "promo");

ALTER TABLE "public"."Luv2_invoice" 
  ALTER COLUMN "promo" SET DEFAULT 0;

ALTER TABLE "public"."Luv2_carts" 
  ADD COLUMN "benefit" varchar(50) DEFAULT 'N';

ALTER TABLE "public"."Luv2_detailinvoice" 
  ADD COLUMN "benefit" varchar(50) DEFAULT 'N';

ALTER TABLE "public"."Luv2_detailinvoice" 
  ADD COLUMN "benefit" varchar(50) NOT NULL DEFAULT 'N',
  ADD CONSTRAINT "Luv2_detailinvoice_pkey" PRIMARY KEY ("invoice", "code", "status", "linenum", "pack", "promo", "benefit");

ALTER TABLE "public"."Luv2_carts" 
  ADD COLUMN "grouping" varchar(255);

ALTER TABLE "public"."Luv2_promo" 
  ADD COLUMN "invoice" varchar(255),
  ADD COLUMN "sync" varchar(1);

ALTER TABLE "public"."Luv2_invoice" 
  ADD COLUMN "cashback" varchar(255) DEFAULT 'N';

DROP TABLE IF EXISTS "public"."Luv2_promo_voucher";
CREATE TABLE "public"."Luv2_promo_voucher" (
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "id_company" int4 NOT NULL DEFAULT 0,
  "voucher" varchar(50) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "value" numeric DEFAULT 0,
  "used" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'N'::character varying
)
;



ALTER TABLE "public"."Luv2_users" 
  ADD COLUMN "code" varchar(3) COLLATE "pg_catalog"."default" DEFAULT ''::character varying;

ALTER TABLE "public"."Luv2_settings" 
  ADD COLUMN "url_admin" varchar(255);
	
	
DROP TABLE IF EXISTS "public"."Luv2_it_req_temp";
CREATE TABLE "public"."Luv2_it_req_temp" (
  "whs_code" varchar(8) COLLATE "pg_catalog"."default",
  "whs_code_from" varchar(8) COLLATE "pg_catalog"."default",
  "date" date,
  "comments" varchar(254) COLLATE "pg_catalog"."default",
  "no" varchar(20) COLLATE "pg_catalog"."default",
  "canceled" varchar(1) COLLATE "pg_catalog"."default",
  "id_user" int4,
  "id" int4 NOT NULL GENERATED ALWAYS AS IDENTITY (
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1
),
  "entry" varchar(255) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Indexes structure for table Luv2_it_req_temp
-- ----------------------------
CREATE INDEX "it_req_temp_id_user" ON "public"."Luv2_it_req_temp" USING btree (
  "id_user" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "it_req_temp_no" ON "public"."Luv2_it_req_temp" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_req_temp_whs_code" ON "public"."Luv2_it_req_temp" USING btree (
  "whs_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_req_temp_whs_code_from" ON "public"."Luv2_it_req_temp" USING btree (
  "whs_code_from" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Triggers structure for table Luv2_it_req_temp
-- ----------------------------
CREATE TRIGGER "trig_it_in_temp_delete" AFTER DELETE ON "public"."Luv2_it_req_temp"
FOR EACH ROW
EXECUTE PROCEDURE "public"."trig_it_in_temp_delete"();

-- ----------------------------
-- Primary Key structure for table Luv2_it_req_temp
-- ----------------------------
ALTER TABLE "public"."Luv2_it_req_temp" ADD CONSTRAINT "Luv2_it_in_temp_copy1_pkey1" PRIMARY KEY ("id");




-- ----------------------------
-- Table structure for Luv2_it_req_detail_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_it_req_detail_temp";
CREATE TABLE "public"."Luv2_it_req_detail_temp" (
  "no" varchar(10) COLLATE "pg_catalog"."default",
  "item_code" varchar(50) COLLATE "pg_catalog"."default",
  "qty" numeric(10,0),
  "linenum" int4,
  "id_user" int4,
  "id" int4 NOT NULL GENERATED ALWAYS AS IDENTITY (
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1
),
  "whs_code" varchar(8) COLLATE "pg_catalog"."default",
  "date" date,
  "canceled" varchar(1) COLLATE "pg_catalog"."default",
  "qty_receive" numeric(10,0)
)
;

-- ----------------------------
-- Indexes structure for table Luv2_it_req_detail_temp
-- ----------------------------
CREATE INDEX "it_req_temp_detail_item_code" ON "public"."Luv2_it_req_detail_temp" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_req_temp_detail_no" ON "public"."Luv2_it_req_detail_temp" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table Luv2_it_req_detail_temp
-- ----------------------------
ALTER TABLE "public"."Luv2_it_req_detail_temp" ADD CONSTRAINT "Luv2_it_in_temp_detail_copy1_pkey1" PRIMARY KEY ("id");



-- ----------------------------
-- Table structure for Luv2_it_req_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_it_req_detail";
CREATE TABLE "public"."Luv2_it_req_detail" (
  "id" int4 NOT NULL GENERATED ALWAYS AS IDENTITY (
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1
),
  "no" varchar(20) COLLATE "pg_catalog"."default",
  "item_code" varchar(50) COLLATE "pg_catalog"."default",
  "qty" numeric(10,0),
  "created_at" timestamp(6),
  "updated_at" timestamp(6),
  "linenum" int4,
  "qty_receive" numeric(10,0)
)
;

-- ----------------------------
-- Indexes structure for table Luv2_it_req_detail
-- ----------------------------
CREATE INDEX "it_req_detail_item_code" ON "public"."Luv2_it_req_detail" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_req_detail_no" ON "public"."Luv2_it_req_detail" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table Luv2_it_req_detail
-- ----------------------------
ALTER TABLE "public"."Luv2_it_req_detail" ADD CONSTRAINT "Luv2_it_in_detail_copy1_pkey1" PRIMARY KEY ("id");



-- ----------------------------
-- Table structure for Luv2_it_req
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_it_req";
CREATE TABLE "public"."Luv2_it_req" (
  "whs_code" varchar(8) COLLATE "pg_catalog"."default",
  "whs_code_from" varchar(8) COLLATE "pg_catalog"."default",
  "date" date,
  "comments" varchar(254) COLLATE "pg_catalog"."default",
  "no" varchar(20) COLLATE "pg_catalog"."default",
  "canceled" varchar(1) COLLATE "pg_catalog"."default",
  "status" varchar(100) COLLATE "pg_catalog"."default" DEFAULT 'Not Checked'::character varying,
  "id" int4 NOT NULL GENERATED ALWAYS AS IDENTITY (
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1
),
  "entry" varchar(255) COLLATE "pg_catalog"."default",
  "id_user" varchar(255) COLLATE "pg_catalog"."default",
  "sign" varchar(5) COLLATE "pg_catalog"."default" DEFAULT 'N'::character varying,
  "sync" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'N'::character varying
)
;

-- ----------------------------
-- Indexes structure for table Luv2_it_req
-- ----------------------------
CREATE INDEX "it_req_temp_id_user_copy1" ON "public"."Luv2_it_req" USING btree (
  "status" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_req_temp_no_copy1" ON "public"."Luv2_it_req" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_req_temp_whs_code_copy1" ON "public"."Luv2_it_req" USING btree (
  "whs_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_req_temp_whs_code_from_copy1" ON "public"."Luv2_it_req" USING btree (
  "whs_code_from" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Triggers structure for table Luv2_it_req
-- ----------------------------
CREATE TRIGGER "trig_it_in_temp_delete" AFTER DELETE ON "public"."Luv2_it_req"
FOR EACH ROW
EXECUTE PROCEDURE "public"."trig_it_in_temp_delete"();

-- ----------------------------
-- Primary Key structure for table Luv2_it_req
-- ----------------------------
ALTER TABLE "public"."Luv2_it_req" ADD CONSTRAINT "Luv2_it_req_temp_copy1_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Table structure for Luv2_promo_bundling_qty
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_promo_bundling_qty";
CREATE TABLE "public"."Luv2_promo_bundling_qty" (
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "id_company" int4 NOT NULL DEFAULT 0,
  "qty" int2 NOT NULL DEFAULT 0,
  "disc" numeric DEFAULT 0,
  "disc_price" numeric DEFAULT 0
)
;

-- ----------------------------
-- Table structure for Luv2_promo_bundling_qty_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_promo_bundling_qty_temp";
CREATE TABLE "public"."Luv2_promo_bundling_qty_temp" (
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "id_company" int4 NOT NULL DEFAULT 0,
  "qty" int2 NOT NULL DEFAULT 0,
  "disc" numeric DEFAULT 0,
  "disc_price" numeric DEFAULT 0,
  "id_user" int4
)
;

-- ----------------------------
-- Indexes structure for table Luv2_promo_bundling_qty
-- ----------------------------
CREATE INDEX "promo_inf_bundling_no" ON "public"."Luv2_promo_bundling_qty" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_inf_bundling_qty" ON "public"."Luv2_promo_bundling_qty" USING btree (
  "qty" "pg_catalog"."int2_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table Luv2_promo_bundling_qty
-- ----------------------------
ALTER TABLE "public"."Luv2_promo_bundling_qty" ADD CONSTRAINT "Luv2_promo_inf_bundling_pkey" PRIMARY KEY ("no", "id_company", "qty");

-- ----------------------------
-- Indexes structure for table Luv2_promo_bundling_qty_temp
-- ----------------------------
CREATE INDEX "promo_inf_bundling_no_copy1" ON "public"."Luv2_promo_bundling_qty_temp" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_inf_bundling_qty_copy1" ON "public"."Luv2_promo_bundling_qty_temp" USING btree (
  "qty" "pg_catalog"."int2_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table Luv2_promo_bundling_qty_temp
-- ----------------------------
ALTER TABLE "public"."Luv2_promo_bundling_qty_temp" ADD CONSTRAINT "Luv2_promo_bundling_qty_copy1_pkey" PRIMARY KEY ("no", "id_company", "qty");


-- ----------------------------
-- Table structure for Luv2_promo_item_gwp_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_promo_item_gwp_temp";
CREATE TABLE "public"."Luv2_promo_item_gwp_temp" (
  "id_company" int4 NOT NULL DEFAULT 0,
  "id_user" int4 NOT NULL DEFAULT 0,
  "item_code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "item_barcode" varchar(225) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "item_name" varchar(100) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL
)
;

-- ----------------------------
-- Indexes structure for table Luv2_promo_item_gwp_temp
-- ----------------------------
CREATE INDEX "promo_item_gwp_temp_id_company" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "id_company" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_temp_id_user" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "id_user" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_temp_item_barcode" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "item_barcode" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_temp_item_code" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_temp_item_name" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "item_name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table Luv2_promo_item_gwp_temp
-- ----------------------------
ALTER TABLE "public"."Luv2_promo_item_gwp_temp" ADD CONSTRAINT "Luv2_promo_item_gwp_temp_pkey" PRIMARY KEY ("no", "item_code", "id_company");


-- ----------------------------
-- Table structure for Luv2_promo_item_gwp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_promo_item_gwp";
CREATE TABLE "public"."Luv2_promo_item_gwp" (
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL,
  "id_company" int4 NOT NULL DEFAULT 0,
  "item_code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "item_barcode" varchar(225) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "item_name" varchar(100) COLLATE "pg_catalog"."default" DEFAULT ''::character varying
)
;

-- ----------------------------
-- Indexes structure for table Luv2_promo_item_gwp
-- ----------------------------
CREATE INDEX "promo_item_gwp_id_company" ON "public"."Luv2_promo_item_gwp" USING btree (
  "id_company" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_item_barcode" ON "public"."Luv2_promo_item_gwp" USING btree (
  "item_barcode" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_item_code" ON "public"."Luv2_promo_item_gwp" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_item_name" ON "public"."Luv2_promo_item_gwp" USING btree (
  "item_name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_no" ON "public"."Luv2_promo_item_gwp" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table Luv2_promo_item_gwp
-- ----------------------------
ALTER TABLE "public"."Luv2_promo_item_gwp" ADD CONSTRAINT "Luv2_promo_item_gwp_temp_copy1_pkey" PRIMARY KEY ("no", "id_company", "item_code");

ALTER TABLE "public"."Luv2_settings" 
  ADD COLUMN "member_group" int4;

ALTER TABLE "public"."Luv2_it_req_detail" 
  DROP CONSTRAINT "Luv2_it_in_detail_copy1_pkey1",
  ALTER COLUMN "no" SET NOT NULL,
  ALTER COLUMN "item_code" SET NOT NULL,
  ADD CONSTRAINT "Luv2_it_in_detail_copy1_pkey1" PRIMARY KEY ("id", "no", "item_code", "linenum");

  /*
 Navicat Premium Data Transfer

 Source Server         : POS
 Source Server Type    : PostgreSQL
 Source Server Version : 140012 (140012)
 Source Host           : 192.168.0.21:5432
 Source Catalog        : demorcsmpro
 Source Schema         : public

 Target Server Type    : PostgreSQL
 Target Server Version : 140012 (140012)
 File Encoding         : 65001

 Date: 27/06/2024 12:46:44
*/


-- ----------------------------
-- Table structure for Luv2_detailinvoice_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_detailinvoice_temp";
CREATE TABLE "public"."Luv2_detailinvoice_temp" (
  "code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "name" varchar(255) COLLATE "pg_catalog"."default",
  "price" numeric(10,2),
  "qty" numeric(10,2),
  "created_at" timestamp(6),
  "updated_at" timestamp(6),
  "total_price" numeric(10,2),
  "id_member" varchar(255) COLLATE "pg_catalog"."default",
  "id_sales" varchar(255) COLLATE "pg_catalog"."default",
  "id_user" varchar(255) COLLATE "pg_catalog"."default",
  "invoice" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "status" varchar(10) COLLATE "pg_catalog"."default" NOT NULL DEFAULT 0,
  "disc" varchar(255) COLLATE "pg_catalog"."default",
  "nprice" numeric(10,0),
  "barcode" varchar(255) COLLATE "pg_catalog"."default",
  "sandbox" varchar(255) COLLATE "pg_catalog"."default",
  "linenum" int4 NOT NULL DEFAULT 0,
  "id_usersync" int8,
  "whs_code" varchar(15) COLLATE "pg_catalog"."default",
  "canceled" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'N'::character varying
)
;

-- ----------------------------
-- Table structure for Luv2_invoice_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_invoice_temp";
CREATE TABLE "public"."Luv2_invoice_temp" (
  "id" int8,
  "id_user" int8,
  "no" varchar(255) COLLATE "pg_catalog"."default",
  "payment" varchar(255) COLLATE "pg_catalog"."default",
  "paid" varchar(255) COLLATE "pg_catalog"."default" DEFAULT 0,
  "change" varchar(255) COLLATE "pg_catalog"."default" DEFAULT 0,
  "date" varchar(255) COLLATE "pg_catalog"."default",
  "created_at" timestamp(6),
  "updated_at" timestamp(6),
  "no_inv" varchar(255) COLLATE "pg_catalog"."default",
  "note" text COLLATE "pg_catalog"."default",
  "must_paid" numeric(20,0),
  "id_member" varchar(255) COLLATE "pg_catalog"."default",
  "disc_total" varchar(255) COLLATE "pg_catalog"."default",
  "sandbox" varchar(255) COLLATE "pg_catalog"."default",
  "sync" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'N'::character varying,
  "cardcode" varchar(255) COLLATE "pg_catalog"."default",
  "canceled" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'N'::character varying,
  "subtotal" numeric(20,2),
  "total_qty" numeric(10,2),
  "id_sales" int4,
  "id_usersync" int8
)
;

-- ----------------------------
-- Table structure for Luv2_it_in_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_it_in_temp";
CREATE TABLE "public"."Luv2_it_in_temp" (
  "whs_code" varchar(8) COLLATE "pg_catalog"."default",
  "whs_code_from" varchar(8) COLLATE "pg_catalog"."default",
  "date" date,
  "comments" varchar(254) COLLATE "pg_catalog"."default",
  "no" varchar(20) COLLATE "pg_catalog"."default",
  "canceled" varchar(1) COLLATE "pg_catalog"."default",
  "id_user" int4,
  "id" int4 NOT NULL GENERATED ALWAYS AS IDENTITY (
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1
)
)
;

-- ----------------------------
-- Table structure for Luv2_it_in_temp_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_it_in_temp_detail";
CREATE TABLE "public"."Luv2_it_in_temp_detail" (
  "no" varchar(10) COLLATE "pg_catalog"."default",
  "item_code" varchar(50) COLLATE "pg_catalog"."default",
  "qty" numeric(10,0),
  "linenum" int4,
  "id_user" int4,
  "id" int4 NOT NULL GENERATED ALWAYS AS IDENTITY (
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1
),
  "whs_code" varchar(8) COLLATE "pg_catalog"."default",
  "date" date,
  "canceled" varchar(1) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for Luv2_it_out_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_it_out_temp";
CREATE TABLE "public"."Luv2_it_out_temp" (
  "whs_code" varchar(8) COLLATE "pg_catalog"."default",
  "whs_code_to" varchar(8) COLLATE "pg_catalog"."default",
  "date" date,
  "comments" varchar(254) COLLATE "pg_catalog"."default",
  "no" varchar(20) COLLATE "pg_catalog"."default",
  "canceled" varchar(1) COLLATE "pg_catalog"."default",
  "id_user" int4,
  "id" int4 NOT NULL GENERATED ALWAYS AS IDENTITY (
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1
)
)
;

-- ----------------------------
-- Table structure for Luv2_it_out_temp_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_it_out_temp_detail";
CREATE TABLE "public"."Luv2_it_out_temp_detail" (
  "no" varchar(10) COLLATE "pg_catalog"."default",
  "item_code" varchar(50) COLLATE "pg_catalog"."default",
  "qty" numeric(10,0),
  "linenum" int4,
  "id_user" int4,
  "id" int4 NOT NULL GENERATED ALWAYS AS IDENTITY (
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1
),
  "whs_code" varchar(8) COLLATE "pg_catalog"."default",
  "date" date,
  "canceled" varchar(1) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for Luv2_it_req_detail_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_it_req_detail_temp";
CREATE TABLE "public"."Luv2_it_req_detail_temp" (
  "no" varchar(10) COLLATE "pg_catalog"."default",
  "item_code" varchar(50) COLLATE "pg_catalog"."default",
  "qty" numeric(10,0),
  "linenum" int4,
  "id_user" int4,
  "id" int4 NOT NULL GENERATED ALWAYS AS IDENTITY (
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1
),
  "whs_code" varchar(8) COLLATE "pg_catalog"."default",
  "date" date,
  "canceled" varchar(1) COLLATE "pg_catalog"."default",
  "qty_receive" numeric(10,0)
)
;

-- ----------------------------
-- Table structure for Luv2_it_req_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_it_req_temp";
CREATE TABLE "public"."Luv2_it_req_temp" (
  "whs_code" varchar(8) COLLATE "pg_catalog"."default",
  "whs_code_from" varchar(8) COLLATE "pg_catalog"."default",
  "date" date,
  "comments" varchar(254) COLLATE "pg_catalog"."default",
  "no" varchar(20) COLLATE "pg_catalog"."default",
  "canceled" varchar(1) COLLATE "pg_catalog"."default",
  "id_user" int4,
  "id" int4 NOT NULL GENERATED ALWAYS AS IDENTITY (
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1
),
  "entry" varchar(255) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for Luv2_item_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_item_temp";
CREATE TABLE "public"."Luv2_item_temp" (
  "code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "barcode" varchar(254) COLLATE "pg_catalog"."default",
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "group_code" int2,
  "status" int8 DEFAULT 0,
  "id_user" int4,
  "idprice1" int4,
  "price1" numeric(10,0),
  "idprice2" int4,
  "price2" numeric(10,0),
  "inventory" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'Y'::character varying,
  "sales" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'Y'::character varying,
  "purchase" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'Y'::character varying,
  "U_IDU_Brand" varchar(30) COLLATE "pg_catalog"."default",
  "U_IDU_Gender" varchar(30) COLLATE "pg_catalog"."default",
  "U_IDU_Function" varchar(30) COLLATE "pg_catalog"."default",
  "U_IDU_Styles" varchar(30) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for Luv2_item_temp_pricelist
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_item_temp_pricelist";
CREATE TABLE "public"."Luv2_item_temp_pricelist" (
  "item_code" varchar(100) COLLATE "pg_catalog"."default",
  "id_pricelist" int2,
  "price" numeric(10,2),
  "id_user" int4
)
;

-- ----------------------------
-- Table structure for Luv2_item_temp_pricelist_disc
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_item_temp_pricelist_disc";
CREATE TABLE "public"."Luv2_item_temp_pricelist_disc" (
  "item_code" varchar(50) COLLATE "pg_catalog"."default",
  "id_pricelist" int2,
  "from_date" date,
  "to_date" date,
  "id_user" int4,
  "linenum" int4,
  "disc" numeric(10,2),
  "disc_price" numeric(10,0),
  "cardcode" varchar(20) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying
)
;

-- ----------------------------
-- Table structure for Luv2_item_temp_pricelist_disc_qty
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_item_temp_pricelist_disc_qty";
CREATE TABLE "public"."Luv2_item_temp_pricelist_disc_qty" (
  "item_code" varchar(50) COLLATE "pg_catalog"."default",
  "id_pricelist" int2,
  "qty" numeric(10,0),
  "disc" numeric(10,2),
  "disc_price" numeric(10,0),
  "id_user" int4,
  "linenum_period" int4,
  "linenum" int4,
  "cardcode" varchar(20) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying
)
;

-- ----------------------------
-- Table structure for Luv2_item_trans_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_item_trans_temp";
CREATE TABLE "public"."Luv2_item_trans_temp" (
  "whs_code" varchar(8) COLLATE "pg_catalog"."default" NOT NULL,
  "no_trans" varchar(20) COLLATE "pg_catalog"."default" NOT NULL,
  "tipe" varchar(2) COLLATE "pg_catalog"."default" NOT NULL,
  "qty" numeric(10,2),
  "created_at" timestamp(6),
  "updated_at" timestamp(6),
  "date" date,
  "canceled" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'N'::character varying,
  "item_code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "linenum" int4 NOT NULL,
  "id_user" int4
)
;

-- ----------------------------
-- Table structure for Luv2_member_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_member_temp";
CREATE TABLE "public"."Luv2_member_temp" (
  "id" int8 NOT NULL DEFAULT nextval('members_id_seq'::regclass),
  "code" varchar(15) COLLATE "pg_catalog"."default" NOT NULL,
  "name" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "phone" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "email" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "address" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "active" varchar(1) COLLATE "pg_catalog"."default" NOT NULL DEFAULT 'Y'::character varying,
  "created_at" timestamp(0),
  "updated_at" timestamp(0),
  "id_user" int4,
  "hobby" varchar(100) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for Luv2_opname_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_opname_temp";
CREATE TABLE "public"."Luv2_opname_temp" (
  "date" date,
  "code" varchar(50) COLLATE "pg_catalog"."default",
  "price" numeric(10,2),
  "opname" numeric(10,0),
  "id_user" int4,
  "barcode" varchar(254) COLLATE "pg_catalog"."default",
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "type" varchar(10) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for Luv2_promo_bundling_qty_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_promo_bundling_qty_temp";
CREATE TABLE "public"."Luv2_promo_bundling_qty_temp" (
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "id_company" int4 NOT NULL DEFAULT 0,
  "qty" int2 NOT NULL DEFAULT 0,
  "disc" numeric DEFAULT 0,
  "disc_price" numeric DEFAULT 0,
  "id_user" int4
)
;

-- ----------------------------
-- Table structure for Luv2_promo_item_gwp_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_promo_item_gwp_temp";
CREATE TABLE "public"."Luv2_promo_item_gwp_temp" (
  "id_company" int4 NOT NULL DEFAULT 0,
  "id_user" int4 NOT NULL DEFAULT 0,
  "item_code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "item_barcode" varchar(225) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "item_name" varchar(100) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL
)
;

-- ----------------------------
-- Table structure for Luv2_promo_item_qty_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_promo_item_qty_temp";
CREATE TABLE "public"."Luv2_promo_item_qty_temp" (
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "id_company" int4 NOT NULL DEFAULT 0,
  "item_code" varchar(50) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "qty" numeric NOT NULL DEFAULT 0,
  "disc" numeric DEFAULT 0,
  "disc_price" numeric DEFAULT 0,
  "id_user" int4
)
;

-- ----------------------------
-- Table structure for Luv2_promo_item_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_promo_item_temp";
CREATE TABLE "public"."Luv2_promo_item_temp" (
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "id_company" int4 NOT NULL DEFAULT 0,
  "item_code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "disc" numeric DEFAULT 0,
  "disc_price" numeric DEFAULT 0,
  "pack" int2 NOT NULL DEFAULT 0,
  "id_user" int4
)
;

-- ----------------------------
-- Table structure for Luv2_promo_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_promo_temp";
CREATE TABLE "public"."Luv2_promo_temp" (
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "id_pricelist" int2 DEFAULT 0,
  "name" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "from_date" date,
  "to_date" date,
  "deleted" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'N'::character varying,
  "id_company" int4 NOT NULL DEFAULT 0,
  "tipe" int2 DEFAULT 0,
  "benefit" int2 DEFAULT 0,
  "date" date,
  "disc" numeric DEFAULT 0,
  "disc_price" numeric DEFAULT 0,
  "qty_pack" numeric(10,2) DEFAULT 0,
  "value_pack" numeric(10,2) DEFAULT 0,
  "voucher_from_date" date,
  "voucher_to_date" date,
  "voucher" numeric DEFAULT 0,
  "invoice" varchar(255) COLLATE "pg_catalog"."default",
  "sync" varchar(1) COLLATE "pg_catalog"."default",
  "id_user" int4
)
;

-- ----------------------------
-- Table structure for Luv2_promo_voucher_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_promo_voucher_temp";
CREATE TABLE "public"."Luv2_promo_voucher_temp" (
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "id_company" int4 NOT NULL DEFAULT 0,
  "voucher" varchar(50) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "value" numeric DEFAULT 0,
  "used" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'N'::character varying,
  "id_user" int4
)
;

-- ----------------------------
-- Table structure for Luv2_salesemp_temp
-- ----------------------------
DROP TABLE IF EXISTS "public"."Luv2_salesemp_temp";
CREATE TABLE "public"."Luv2_salesemp_temp" (
  "code" int4,
  "name" varchar(155) COLLATE "pg_catalog"."default",
  "position" varchar(50) COLLATE "pg_catalog"."default",
  "active" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'Y'::character varying,
  "id_user" int4,
  "remark" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Primary Key structure for table Luv2_detailinvoice_temp
-- ----------------------------
ALTER TABLE "public"."Luv2_detailinvoice_temp" ADD CONSTRAINT "Luv2_detailinvoice_copy1_pkey" PRIMARY KEY ("invoice", "code", "status", "linenum");

-- ----------------------------
-- Indexes structure for table Luv2_it_in_temp
-- ----------------------------
CREATE INDEX "it_in_temp_id_user" ON "public"."Luv2_it_in_temp" USING btree (
  "id_user" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "it_in_temp_no" ON "public"."Luv2_it_in_temp" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_in_temp_whs_code" ON "public"."Luv2_it_in_temp" USING btree (
  "whs_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_in_temp_whs_code_from" ON "public"."Luv2_it_in_temp" USING btree (
  "whs_code_from" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Triggers structure for table Luv2_it_in_temp
-- ----------------------------
CREATE TRIGGER "trig_it_in_temp_delete" AFTER DELETE ON "public"."Luv2_it_in_temp"
FOR EACH ROW
EXECUTE PROCEDURE "public"."trig_it_in_temp_delete"();

-- ----------------------------
-- Primary Key structure for table Luv2_it_in_temp
-- ----------------------------
ALTER TABLE "public"."Luv2_it_in_temp" ADD CONSTRAINT "Luv2_it_in_temp_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table Luv2_it_in_temp_detail
-- ----------------------------
CREATE INDEX "it_in_temp_detail_item_code" ON "public"."Luv2_it_in_temp_detail" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_in_temp_detail_no" ON "public"."Luv2_it_in_temp_detail" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table Luv2_it_in_temp_detail
-- ----------------------------
ALTER TABLE "public"."Luv2_it_in_temp_detail" ADD CONSTRAINT "Luv2_it_in_temp_detail_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table Luv2_it_out_temp
-- ----------------------------
CREATE INDEX "it_out_temp_id_user" ON "public"."Luv2_it_out_temp" USING btree (
  "id_user" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "it_out_temp_no" ON "public"."Luv2_it_out_temp" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_out_temp_whs_code" ON "public"."Luv2_it_out_temp" USING btree (
  "whs_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_out_temp_whs_code_to" ON "public"."Luv2_it_out_temp" USING btree (
  "whs_code_to" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Triggers structure for table Luv2_it_out_temp
-- ----------------------------
CREATE TRIGGER "trig_it_out_temp_delete" AFTER DELETE ON "public"."Luv2_it_out_temp"
FOR EACH ROW
EXECUTE PROCEDURE "public"."trig_it_out_temp_delete"();

-- ----------------------------
-- Primary Key structure for table Luv2_it_out_temp
-- ----------------------------
ALTER TABLE "public"."Luv2_it_out_temp" ADD CONSTRAINT "Luv2_it_in_temp_copy1_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table Luv2_it_out_temp_detail
-- ----------------------------
CREATE INDEX "it_out_temp_detail_item_code" ON "public"."Luv2_it_out_temp_detail" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_out_temp_detail_no" ON "public"."Luv2_it_out_temp_detail" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table Luv2_it_out_temp_detail
-- ----------------------------
ALTER TABLE "public"."Luv2_it_out_temp_detail" ADD CONSTRAINT "Luv2_it_in_temp_detail_copy1_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table Luv2_it_req_detail_temp
-- ----------------------------
CREATE INDEX "it_req_temp_detail_item_code" ON "public"."Luv2_it_req_detail_temp" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_req_temp_detail_no" ON "public"."Luv2_it_req_detail_temp" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table Luv2_it_req_detail_temp
-- ----------------------------
ALTER TABLE "public"."Luv2_it_req_detail_temp" ADD CONSTRAINT "Luv2_it_in_temp_detail_copy1_pkey1" PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table Luv2_it_req_temp
-- ----------------------------
CREATE INDEX "it_req_temp_id_user" ON "public"."Luv2_it_req_temp" USING btree (
  "id_user" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "it_req_temp_no" ON "public"."Luv2_it_req_temp" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_req_temp_whs_code" ON "public"."Luv2_it_req_temp" USING btree (
  "whs_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "it_req_temp_whs_code_from" ON "public"."Luv2_it_req_temp" USING btree (
  "whs_code_from" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Triggers structure for table Luv2_it_req_temp
-- ----------------------------
CREATE TRIGGER "trig_it_in_temp_delete" AFTER DELETE ON "public"."Luv2_it_req_temp"
FOR EACH ROW
EXECUTE PROCEDURE "public"."trig_it_in_temp_delete"();

-- ----------------------------
-- Primary Key structure for table Luv2_it_req_temp
-- ----------------------------
ALTER TABLE "public"."Luv2_it_req_temp" ADD CONSTRAINT "Luv2_it_in_temp_copy1_pkey1" PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table Luv2_item_temp
-- ----------------------------
CREATE INDEX "item_temp_barcode" ON "public"."Luv2_item_temp" USING btree (
  "barcode" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "item_temp_code" ON "public"."Luv2_item_temp" USING btree (
  "code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "item_temp_group_code" ON "public"."Luv2_item_temp" USING btree (
  "group_code" "pg_catalog"."int2_ops" ASC NULLS LAST
);
CREATE INDEX "item_temp_name" ON "public"."Luv2_item_temp" USING btree (
  "name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Triggers structure for table Luv2_item_temp
-- ----------------------------
CREATE TRIGGER "trig_item_temp_delete" AFTER DELETE ON "public"."Luv2_item_temp"
FOR EACH ROW
EXECUTE PROCEDURE "public"."trig_item_temp_delete"();

-- ----------------------------
-- Indexes structure for table Luv2_item_temp_pricelist
-- ----------------------------
CREATE INDEX "item_temp_pricelist_id_pricelist" ON "public"."Luv2_item_temp_pricelist" USING btree (
  "id_pricelist" "pg_catalog"."int2_ops" ASC NULLS LAST
);
CREATE INDEX "item_temp_pricelist_id_user" ON "public"."Luv2_item_temp_pricelist" USING btree (
  "id_user" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "item_temp_pricelist_item_code" ON "public"."Luv2_item_temp_pricelist" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table Luv2_item_temp_pricelist_disc
-- ----------------------------
CREATE INDEX "item_temp_pricelist_disc_period_id_pricelist" ON "public"."Luv2_item_temp_pricelist_disc" USING btree (
  "id_pricelist" "pg_catalog"."int2_ops" ASC NULLS LAST
);
CREATE INDEX "item_temp_pricelist_disc_period_item_code" ON "public"."Luv2_item_temp_pricelist_disc" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "item_temp_pricelist_disc_period_linenum" ON "public"."Luv2_item_temp_pricelist_disc" USING btree (
  "linenum" "pg_catalog"."int4_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table Luv2_item_temp_pricelist_disc_qty
-- ----------------------------
CREATE INDEX "item_temp_pricelist_disc_qty_id_pricelist" ON "public"."Luv2_item_temp_pricelist_disc_qty" USING btree (
  "id_pricelist" "pg_catalog"."int2_ops" ASC NULLS LAST
);
CREATE INDEX "item_temp_pricelist_disc_qty_id_user" ON "public"."Luv2_item_temp_pricelist_disc_qty" USING btree (
  "id_user" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "item_temp_pricelist_disc_qty_item_code" ON "public"."Luv2_item_temp_pricelist_disc_qty" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "item_temp_pricelist_disc_qty_linenum" ON "public"."Luv2_item_temp_pricelist_disc_qty" USING btree (
  "linenum" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "item_temp_pricelist_disc_qty_linenum_period" ON "public"."Luv2_item_temp_pricelist_disc_qty" USING btree (
  "linenum_period" "pg_catalog"."int4_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table Luv2_item_trans_temp
-- ----------------------------
CREATE INDEX "item_trans_temp_item_code" ON "public"."Luv2_item_trans_temp" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "item_trans_temp_no_trans" ON "public"."Luv2_item_trans_temp" USING btree (
  "no_trans" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "item_trans_temp_tipe" ON "public"."Luv2_item_trans_temp" USING btree (
  "tipe" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "item_trans_temp_whs_code" ON "public"."Luv2_item_trans_temp" USING btree (
  "whs_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table Luv2_item_trans_temp
-- ----------------------------
ALTER TABLE "public"."Luv2_item_trans_temp" ADD CONSTRAINT "Luv2_item_trans_copy1_pkey" PRIMARY KEY ("whs_code", "tipe", "no_trans", "item_code", "linenum");

-- ----------------------------
-- Indexes structure for table Luv2_member_temp
-- ----------------------------
CREATE INDEX "member_temp_code" ON "public"."Luv2_member_temp" USING btree (
  "code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "member_temp_id" ON "public"."Luv2_member_temp" USING btree (
  "id" "pg_catalog"."int8_ops" ASC NULLS LAST
);
CREATE INDEX "member_temp_name" ON "public"."Luv2_member_temp" USING btree (
  "name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table Luv2_member_temp
-- ----------------------------
ALTER TABLE "public"."Luv2_member_temp" ADD CONSTRAINT "Luv2_member_copy1_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Indexes structure for table Luv2_opname_temp
-- ----------------------------
CREATE INDEX "opname_date_copy1" ON "public"."Luv2_opname_temp" USING btree (
  "date" "pg_catalog"."date_ops" ASC NULLS LAST
);
CREATE INDEX "opname_id_user_copy1" ON "public"."Luv2_opname_temp" USING btree (
  "id_user" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "opname_item_code_copy1" ON "public"."Luv2_opname_temp" USING btree (
  "code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Indexes structure for table Luv2_promo_bundling_qty_temp
-- ----------------------------
CREATE INDEX "promo_inf_bundling_no_copy1" ON "public"."Luv2_promo_bundling_qty_temp" USING btree (
  "no" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_inf_bundling_qty_copy1" ON "public"."Luv2_promo_bundling_qty_temp" USING btree (
  "qty" "pg_catalog"."int2_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table Luv2_promo_bundling_qty_temp
-- ----------------------------
ALTER TABLE "public"."Luv2_promo_bundling_qty_temp" ADD CONSTRAINT "Luv2_promo_bundling_qty_copy1_pkey" PRIMARY KEY ("no", "id_company", "qty");

-- ----------------------------
-- Indexes structure for table Luv2_promo_item_gwp_temp
-- ----------------------------
CREATE INDEX "promo_item_gwp_temp_id_company" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "id_company" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_temp_id_user" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "id_user" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_temp_item_barcode" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "item_barcode" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_temp_item_code" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "item_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "promo_item_gwp_temp_item_name" ON "public"."Luv2_promo_item_gwp_temp" USING btree (
  "item_name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table Luv2_promo_item_gwp_temp
-- ----------------------------
ALTER TABLE "public"."Luv2_promo_item_gwp_temp" ADD CONSTRAINT "Luv2_promo_item_gwp_temp_pkey" PRIMARY KEY ("no", "item_code", "id_company");

-- ----------------------------
-- Indexes structure for table Luv2_salesemp_temp
-- ----------------------------
CREATE INDEX "salesemp_temp_code" ON "public"."Luv2_salesemp_temp" USING btree (
  "code" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "salesemp_temp_name" ON "public"."Luv2_salesemp_temp" USING btree (
  "name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);


ALTER TABLE "public"."Luv2_carts" 
  ADD COLUMN "promo" varchar(12),
  ADD COLUMN "promo_tipe" int2;

ALTER TABLE "public"."Luv2_detailinvoice" 
  ADD COLUMN "promo" varchar(12),
  ADD COLUMN "promo_tipe" int2;

ALTER TABLE "public"."Luv2_invoice" 
  ADD COLUMN "promo" varchar(12);

ALTER TABLE "public"."Luv2_detailinvoice" 
  ADD COLUMN "pack" int2 DEFAULT 0;

ALTER TABLE "public"."Luv2_carts" 
  ADD COLUMN "pack" int2 DEFAULT 0;

ALTER TABLE "public"."Luv2_carts" 
  ALTER COLUMN "price" TYPE varchar(255) COLLATE "pg_catalog"."default";

ALTER TABLE "public"."Luv2_detailinvoice" 
DROP CONSTRAINT "Luv2_detailinvoice_pkey";

UPDATE "public"."Luv2_detailinvoice"
SET "promo" = 0
WHERE "promo" IS NULL;

ALTER TABLE "public"."Luv2_detailinvoice" 
ALTER COLUMN "promo" SET NOT NULL,
ALTER COLUMN "promo" SET DEFAULT 0;

ALTER TABLE "public"."Luv2_detailinvoice" 
ADD CONSTRAINT "Luv2_detailinvoice_pkey" PRIMARY KEY ("invoice", "code", "status", "linenum", "pack", "promo");


ALTER TABLE "public"."Luv2_invoice" 
  ALTER COLUMN "promo" SET DEFAULT 0;

ALTER TABLE "public"."Luv2_carts" 
  DROP COLUMN "free",
  ADD COLUMN "benefit" varchar(50) DEFAULT 'N';

ALTER TABLE "public"."Luv2_detailinvoice" 
  DROP COLUMN "free",
  ADD COLUMN "benefit" varchar(50) DEFAULT 'N';

ALTER TABLE "public"."Luv2_detailinvoice" 
  ADD COLUMN "benefit" varchar(50) NOT NULL DEFAULT 'N',
  ADD CONSTRAINT "Luv2_detailinvoice_pkey" PRIMARY KEY ("invoice", "code", "status", "linenum", "pack", "promo", "benefit");

DROP TABLE IF EXISTS "public"."Luv2_promo_voucher";
CREATE TABLE "public"."Luv2_promo_voucher" (
  "no" varchar(12) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "id_company" int4 NOT NULL DEFAULT 0,
  "voucher" varchar(50) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "value" numeric DEFAULT 0,
  "used" varchar(1) COLLATE "pg_catalog"."default" DEFAULT 'N'::character varying
)
;

DROP TABLE IF EXISTS "public"."Luv2_member_otp";
CREATE TABLE "public"."Luv2_member_otp" (
  "member_code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "otp" varchar(255) COLLATE "pg_catalog"."default",
  "created_at" timestamp(6),
  "updated_at" timestamp(6),
  "expired_at" timestamp(6)
)
;

ALTER TABLE "public"."Luv2_carts" 
  ADD COLUMN "grouping" varchar(255);

ALTER TABLE "public"."Luv2_promo" 
  ADD COLUMN "invoice" varchar(255),
  ADD COLUMN "sync" varchar(1);

ALTER TABLE "public"."Luv2_invoice" 
  ADD COLUMN "cashback" varchar(255) DEFAULT 'N';

ALTER TABLE "public"."Luv2_promo_voucher" 
  ADD COLUMN "used" varchar(1) DEFAULT 'N';

ALTER TABLE "public"."Luv2_users" 
  ADD COLUMN "code" varchar(3) COLLATE "pg_catalog"."default" DEFAULT ''::character varying;

ALTER TABLE "public"."Luv2_settings" 
  ADD COLUMN "url_admin" varchar(255);

ALTER TABLE "public"."Luv2_member" 
  ADD COLUMN "hobby" varchar(100);

ALTER TABLE "public"."Luv2_promo" 
  ADD COLUMN "voucher_from_date" date,
  ADD COLUMN "voucher_to_date" date;


ALTER TABLE "public"."Luv2_it_req" 
  ADD COLUMN "entry" varchar(25);
ALTER TABLE "public"."Luv2_it_req" 
  ALTER COLUMN "status" SET DEFAULT 'Not Checked'::character varying;
ALTER TABLE "public"."Luv2_it_req" 
  ADD COLUMN "sync" varchar(1) DEFAULT 'N';

ALTER TABLE "public"."Luv2_salesemp" 
  ADD COLUMN "remark" varchar(50);

ALTER TABLE "public"."Luv2_warehouse" 
  ADD COLUMN "address" varchar(100) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  ADD COLUMN "phone" varchar(30) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  ADD COLUMN "email" varchar(50) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  ADD COLUMN "footer" text COLLATE "pg_catalog"."default" DEFAULT ''::text;
  
ALTER TABLE "public"."Luv2_promo_item_gwp" 
  ADD COLUMN "disc" decimal(10,2);
  ADD COLUMN "disc_price" decimal(10,2);

ALTER TABLE "public"."Luv2_promo_item_gwp_temp" 
  ADD COLUMN "disc" decimal(10,2);
  ADD COLUMN "disc_price" decimal(10,2);
  
ALTER TABLE "public"."Luv2_detailinvoice" 
  ALTER COLUMN "price" TYPE numeric(20,2),
  ALTER COLUMN "qty" TYPE numeric(20,2),
  ALTER COLUMN "total_price" TYPE numeric(20,2);