Skip to content

Commit

Permalink
Add pgsql8 CREATE INDEX CONCURRENTLY support to definition XML
Browse files Browse the repository at this point in the history
  • Loading branch information
nkiraly committed Jul 6, 2015
1 parent 03f64b3 commit fea639e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ Changes
* Add unit test coverage information via Coveralls https://coveralls.io/r/nkiraly/DBSteward github/nkiraly/DBSteward PR #83
* Fix pgsql8 DEFAULT parenthesis wrapping github/nkiraly/DBSteward PR #84
* Fix pgsql8 index name generation to not exceed maximum length github/nkiraly/DBSteward PR #86
* Add pgsql8 CREATE INDEX CONCURRENTLY support to definition XML


Supported Platform DDL Generation and Differencing:
Expand Down
1 change: 1 addition & 0 deletions lib/DBSteward/dbsteward.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
<!ELEMENT index (indexDimension+, indexWhere?)>
<!ATTLIST index name CDATA #REQUIRED>
<!ATTLIST index unique (true|false) #IMPLIED>
<!ATTLIST index concurrently (true|false) #IMPLIED>
<!ATTLIST index using (hash|btree|gist|gin|KEY) #REQUIRED>
<!ELEMENT indexDimension (#PCDATA)>
<!ATTLIST indexDimension name CDATA #REQUIRED>
Expand Down
12 changes: 10 additions & 2 deletions lib/DBSteward/sql_format/pgsql8/pgsql8_index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ public static function get_creation_sql($node_schema, $node_table, $node_index)
$sql .= "UNIQUE ";
}

$sql .= "INDEX "
. pgsql8::get_quoted_object_name($node_index['name'])
$sql .= "INDEX ";

if ( isset($node_index['concurrently']) && strcasecmp($node_index['concurrently'], 'true') == 0 ) {
$sql .= "CONCURRENTLY ";
}

$sql .= pgsql8::get_quoted_object_name($node_index['name'])
. " ON "
. pgsql8::get_quoted_schema_name($node_schema['name']) . '.'
. pgsql8::get_quoted_table_name($node_table['name']);
Expand Down Expand Up @@ -80,6 +85,9 @@ public static function equals($node_index_a, $node_index_b) {
else if ( strcasecmp($node_index_a['unique'], $node_index_b['unique']) != 0 ) {
$equal = false;
}
else if ( strcasecmp($node_index_a['concurrently'], $node_index_b['concurrently']) != 0 ) {
$equal = false;
}
else if ( strcasecmp($node_index_a['using'], $node_index_b['using']) != 0 ) {
$equal = false;
}
Expand Down

0 comments on commit fea639e

Please sign in to comment.