Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

902 B
Raw Blame
DROP TABLE IF EXISTS product_variant;

-- DROP SEQUENCE IF EXISTS product_variant_seq;
-- CREATE SEQUENCE product_variant_seq;

CREATE TABLE product_variant (
  "product_variant_id" int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, -- SERIAL PRIMARY KEY
  "product_id" int check ("product_id" > 0) NOT NULL,
  "options" varchar(191) NOT NULL DEFAULT '',
  "image" varchar(191) NOT NULL DEFAULT '',
  "price" decimal(15,4) NOT NULL DEFAULT 0.0000,
  "old_price" decimal(15,4) NOT NULL DEFAULT 0.0000,
  "stock_quantity" int NOT NULL DEFAULT 0,
  "weight" decimal(15,8) NOT NULL DEFAULT '0.00000000',
  "sku" varchar(64) NOT NULL DEFAULT '',
  "barcode" varchar(64) NOT NULL DEFAULT ''
  -- PRIMARY KEY("product_variant_id")
);

CREATE INDEX "product_variant_product_id" ON product_variant ("product_id","stock_quantity","options");
CREATE INDEX "product_variant_options" ON product_variant ("options");