-- Product First Group mail mappings (Postgres) -- Two independent mapping tables: -- 1) Costing mails: triggered when a costing is created/updated -- 2) Pricing mails: triggered when pricing is created/updated CREATE TABLE IF NOT EXISTS mk_costing_first_group_mail ( urun_ilk_grubu TEXT NOT NULL, mail_id BIGINT NOT NULL REFERENCES mk_mail(id) ON DELETE CASCADE, PRIMARY KEY (urun_ilk_grubu, mail_id) ); CREATE TABLE IF NOT EXISTS mk_pricing_first_group_mail ( urun_ilk_grubu TEXT NOT NULL, mail_id BIGINT NOT NULL REFERENCES mk_mail(id) ON DELETE CASCADE, PRIMARY KEY (urun_ilk_grubu, mail_id) );