NBGKNI25T2AKNWDH5Z6U6JDUHLQPNRL6GQFF5VS37OOHONSP4CKQC
NDMM44EV2XD5RP7J4Q25ZX52LUP7WOMTKO3C2PDXW7IWFEVWUW6QC
ZI2RJOZ2HXBHX7L54BTSDKESY6NG5KBJLVHCNY7K7ZLGIUOIHQUQC
E4HFJ4L4PAGV7R7EXVG2B2CWDGGW7XWU4D37VURZ66HZ3ILHCFUAC
EGNRBQUMOZHAF5B7KCMTAPMB4H3USK4MK33Q6T5V26D6HOJNW6LQC
VIGS24FLOPPTBLIBZIB2LFMYCDZ3AO4FBXYADAKQMJFNPM4JHAGQC
BUCBGGRUTH7HNAADSU24U4BPHPUY7QYB3KRZPIIDUERZTL3YNTZQC
terpenes text[] not null default '{}',--http://www.databasesoup.com/2015/01/tag-all-things-part-3.html I guess we'll deal with uniqueness and order in application layer or https://stackoverflow.com/a/22677978 ?? will need to do a good job normalizing though. how to search when order matters??
terpenes text[] not null default '{}',--http://www.databasesoup.com/2015/01/tag-all-things-part-3.html I guess we'll deal with uniqueness and order in application layer or https://stackoverflow.com/a/22677978 ?? will need to do a good job normalizing though. how to search when order matters?? https://stackoverflow.com/questions/866465
create unique index unique_variant_2 on variant (product, quantity) where portions is null;
create unique index unique_variant_3 on variant (product, portions, quantity) where portions is not null;
create unique index unique_variant_2 on variant (product, quantity) where portions is null and flavor is null;
create unique index unique_variant_3_portions on variant (product, portions, quantity) where portions is not null and flavor is null;
create unique index unique_variant_3_flavor on variant (product, quantity, flavor) where portions is null and flavor is not null;
create unique index unique_variant_4 on variant (product, portions, quantity, flavor) where portions is not null and flavor is not null;