public function testNoQuoteIndexIdentifierDimensions() { $xml = <<<XML <schema name="test"> <table name="test"> <index name="idx" using="btree" unique="false"> <indexDimension name="idx_1">col1</indexDimension> <indexDimension name="idx_2" sql="true">x + 1</indexDimension> <indexDimension name="idx_3">x + 1</indexDimension> </index> </table> </schema> XML; $schema = simplexml_load_string($xml); $sql = pgsql8_index::get_creation_sql($schema, $schema->table, $schema->table->index); $this->assertEquals('CREATE INDEX "idx" ON "test"."test" USING btree ("col1", x + 1, "x + 1");', $sql); }
public static function diff_indexes_table($ofs, $old_schema, $old_table, $new_schema, $new_table) { // Drop indexes that do not exist in new schema or are modified foreach (self::get_drop_indexes($old_schema, $old_table, $new_schema, $new_table) as $index) { $ofs->write(pgsql8_index::get_drop_sql($new_schema, $new_table, $index)); } // Add new indexes if ($old_schema == null) { foreach (format_index::get_table_indexes($new_schema, $new_table) as $index) { $ofs->write(pgsql8_index::get_creation_sql($new_schema, $new_table, $index) . "\n"); } } else { foreach (self::get_new_indexes($old_schema, $old_table, $new_schema, $new_table) as $index) { $ofs->write(pgsql8_index::get_creation_sql($new_schema, $new_table, $index) . "\n"); } } }