/** * In postgresql indexes cannot be part of the create table statement. * They have to be created separately */ public function createPartitionTable($tableName, $generatedTableName) { $sql = $this->getPartitionTableSql($tableName, $generatedTableName); $this->db->query($sql); $indexes = Schema::getInstance()->getIndexesCreateSql(); $indexes = $indexes[$tableName]; foreach ($indexes as $index) { $index = str_replace('#table#', $generatedTableName, $index); $this->db->query($index); } }
/** * Get the SQL to create a specific Piwik table * * @param string $tableName Unprefixed table name. * @return string SQL */ public static function getTableCreateSql($tableName) { return Schema::getInstance()->getTableCreateSql($tableName); }