prefix.DB::$namespace.'_voucher_redemptions'; } public function __construct() { parent::__construct(); $this->table_name = $this->prefix.'_voucher_redemptions'; $this->primary_key = 'id'; $this->version = '1.0'; } public function sql_create() { return "CREATE TABLE {$this->table_name} ( id bigint(20) NOT NULL AUTO_INCREMENT, restaurant_id bigint(20) NOT NULL, voucher_id bigint(20) NOT NULL, booking_id bigint(20) DEFAULT NULL, user_id bigint(20) DEFAULT NULL, type varchar(25) DEFAULT 'redeem', amount int DEFAULT 0, note text DEFAULT NULL, settings longtext DEFAULT NULL, date_created datetime NOT NULL, date_modified datetime NOT NULL, PRIMARY KEY (id), KEY `voucher_redemptions_restaurant_id_foreign` (`restaurant_id`), CONSTRAINT `voucher_redemptions_restaurant_id_foreign` FOREIGN KEY (`restaurant_id`) REFERENCES `{$this->prefix}_restaurants` (`id`) ON DELETE CASCADE, KEY `voucher_redemptions_voucher_id_foreign` (`voucher_id`), CONSTRAINT `voucher_redemptions_voucher_id_foreign` FOREIGN KEY (`voucher_id`) REFERENCES `{$this->prefix}_vouchers` (`id`) ON DELETE CASCADE, KEY voucher_redemptions_booking_id (booking_id) )"; } } SRR_DB_Voucher_Redemptions::init();