prefix.DB::$namespace.'_layouts'; } public function __construct() { parent::__construct(); $this->table_name = $this->prefix.'_layouts'; $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(255) DEFAULT NULL, restaurant_id bigint(20) DEFAULT NULL, name varchar(255) NOT NULL, description text DEFAULT NULL, image varchar(500) DEFAULT NULL, settings longtext DEFAULT NULL, active tinyint(1) DEFAULT 1, ordering int(11) DEFAULT 1, date_created datetime NOT NULL, date_modified datetime NOT NULL, PRIMARY KEY (id), UNIQUE KEY `layouts_uuid_unique` (`uuid`), KEY `layouts_restaurant_id_foreign` (`restaurant_id`), KEY `layouts_restaurant_active_index` (`restaurant_id`, `active`), KEY `layouts_ordering_index` (`ordering`), CONSTRAINT `layouts_restaurant_id_foreign` FOREIGN KEY (`restaurant_id`) REFERENCES `{$this->prefix}_restaurants` (`id`) ON DELETE CASCADE )"; } public function sql_update_columns_releases() { $queries = []; // Future releases can add columns here $queries['125'][] = "ALTER TABLE {$this->table_name} ADD uploaded_image varchar(500) DEFAULT NULL after image"; $this->run_queries_updates($queries); } } SRR_DB_Layouts::init();