exec( "CREATE TABLE IF NOT EXISTS tbl_scitemcustom ( cl_scitemcustom_id INT(11) NOT NULL AUTO_INCREMENT, cl_scitemcustom_obj_id INT(10) UNSIGNED NOT NULL, cl_scitemcustom_created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (cl_scitemcustom_id), UNIQUE KEY uq_scitemcustom_obj (cl_scitemcustom_obj_id), KEY idx_scitemcustom_obj (cl_scitemcustom_obj_id), CONSTRAINT fk_scitemcustom_obj FOREIGN KEY (cl_scitemcustom_obj_id) REFERENCES tbl_scobjs (cl_scobjs_id) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" ); $db->exec( "CREATE TABLE IF NOT EXISTS tbl_scitemcustomstat ( cl_scitemcustomstat_id INT(11) NOT NULL AUTO_INCREMENT, cl_scitemcustomstat_itemcustom_id INT(11) NOT NULL, cl_scitemcustomstat_stat_id INT(11) NOT NULL, cl_scitemcustomstat_sign ENUM('+', '-') NOT NULL DEFAULT '+', cl_scitemcustomstat_value DECIMAL(10,2) NOT NULL DEFAULT 0.00, cl_scitemcustomstat_created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (cl_scitemcustomstat_id), UNIQUE KEY uq_scitemcustomstat_item_stat (cl_scitemcustomstat_itemcustom_id, cl_scitemcustomstat_stat_id), KEY idx_scitemcustomstat_item (cl_scitemcustomstat_itemcustom_id), KEY idx_scitemcustomstat_stat (cl_scitemcustomstat_stat_id), CONSTRAINT fk_scitemcustomstat_item FOREIGN KEY (cl_scitemcustomstat_itemcustom_id) REFERENCES tbl_scitemcustom (cl_scitemcustom_id) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT fk_scitemcustomstat_stat FOREIGN KEY (cl_scitemcustomstat_stat_id) REFERENCES tbl_scstatsitem (cl_scstatsitem_id) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" ); $scitemcustom_bootstrap_done = true; }