· 4 years ago · Jun 16, 2021, 07:02 AM
1public class MYForigenKey {
2 private String customer_vs_coupon_table="" +
3 "CREATE TABLE IF NOT EXISTS `couponDB`.`customer_vs_coupons` " +
4 "(" +
5 "`customer_id` INT NOT NULL," +
6 "`coupon_id` INT NOT NULL, PRIMARY KEY (`customer_id`,`coupon_id`)" +
7 ")" +
8 "INDEX `coupon_id_idx` (`coupon_id` ASC) VISIBLE," +
9 "FORIGEN KEY (`customer_id`) " +
10 "REFERENCES `customers`(`id`) ON DELETE CASCADE" +
11 "FORIGEN KEY (`coupon_id`) " +
12 "REFERENCES `coupon`(`id`) ON DELETE CASCADE";
13}
14