prefix.DB::$namespace.'_vouchers'; } public function __construct() { parent::__construct(); $this->table_name = $this->prefix.'_vouchers'; $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, uuid varchar(36) NOT NULL, restaurant_id bigint(20) NOT NULL, code varchar(32) NOT NULL, status varchar(25) DEFAULT 'pending_payment', type varchar(25) DEFAULT 'amount', product_id bigint(20) DEFAULT NULL, initial_amount int DEFAULT 0, remaining_amount int DEFAULT 0, currency varchar(10) DEFAULT NULL, buyer_name varchar(150) DEFAULT NULL, buyer_email varchar(190) DEFAULT NULL, buyer_phone varchar(50) DEFAULT NULL, recipient_name varchar(150) DEFAULT NULL, recipient_email varchar(190) DEFAULT NULL, message text DEFAULT NULL, delivery_date date DEFAULT NULL, delivered tinyint(1) DEFAULT 0, expires_at date DEFAULT NULL, payment_id bigint(20) DEFAULT NULL, language varchar(10) DEFAULT NULL, settings longtext DEFAULT NULL, date_created datetime NOT NULL, date_modified datetime NOT NULL, PRIMARY KEY (id), UNIQUE KEY code (code), KEY `vouchers_restaurant_id_foreign` (`restaurant_id`), CONSTRAINT `vouchers_restaurant_id_foreign` FOREIGN KEY (`restaurant_id`) REFERENCES `{$this->prefix}_restaurants` (`id`) ON DELETE CASCADE, KEY vouchers_status (status), KEY vouchers_expires_at (expires_at) )"; } } SRR_DB_Vouchers::init();