NJ233BBUD2WBHKNEWPO5JWQTECTGR5F43NYTSNOZ5J3K22U5C47QC
NBGKNI25T2AKNWDH5Z6U6JDUHLQPNRL6GQFF5VS37OOHONSP4CKQC
EGNRBQUMOZHAF5B7KCMTAPMB4H3USK4MK33Q6T5V26D6HOJNW6LQC
NDMM44EV2XD5RP7J4Q25ZX52LUP7WOMTKO3C2PDXW7IWFEVWUW6QC
E4HFJ4L4PAGV7R7EXVG2B2CWDGGW7XWU4D37VURZ66HZ3ILHCFUAC
VIGS24FLOPPTBLIBZIB2LFMYCDZ3AO4FBXYADAKQMJFNPM4JHAGQC
ZI2RJOZ2HXBHX7L54BTSDKESY6NG5KBJLVHCNY7K7ZLGIUOIHQUQC
CFWRFX3QZSXT5VAUZQ6R344R4OAZBPL6VTQACDNOYMHJICP4QALAC
create type product_type as enum ('flower', 'preroll', 'oil', 'spray', 'capsule', 'cartridge', 'disposable', 'tea', 'gummy', 'mint', 'chocolate', 'cookie');
create type product_type as enum ('flower', 'preroll', 'oil', 'spray', 'capsule', 'cartridge', 'disposable', 'tea', 'gummy', 'mint', 'chocolate', 'baked');
joined_brand citext not null,--should probably strip out spaces. higher probability to match?
joined_name citext not null,--should probably strip out spaces. higher probability to match?
type product_type not null,
producer text,
display_brand text not null,
producer text,--null means unknown
brand text,--null means producer is the brand
create unique index unique_product_3p on product (producer, joined_name, type) where brand is null;
create unique index unique_product_3b on product (brand, joined_name, type) where producer is null;
create unique index unique_product_4 on product (producer, brand, joined_name, type) where brand is not null and producer is not null;