prefix.DB::$namespace.'_spaces'; } public function __construct() { parent::__construct(); $this->table_name = $this->prefix.'_spaces'; $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) DEFAULT NULL, area_id bigint(20) DEFAULT NULL, ordering smallint DEFAULT 999, name varchar(100) DEFAULT NULL, image_url varchar(255) DEFAULT NULL, settings longtext DEFAULT NULL, date_created datetime NOT NULL, date_modified datetime NOT NULL, PRIMARY KEY (id), KEY `spaces_restaurant_id_foreign` (`restaurant_id`), CONSTRAINT `spaces_restaurant_id_foreign` FOREIGN KEY (`restaurant_id`) REFERENCES `{$this->prefix}_restaurants` (`id`) ON DELETE CASCADE, KEY `spaces_area_id_foreign` (`area_id`), CONSTRAINT `spaces_area_id_foreign` FOREIGN KEY (`area_id`) REFERENCES `{$this->prefix}_areas` (`id`) ON DELETE CASCADE )"; } } SRR_DB_Spaces::init();