node-pg-migrate
Advanced tools
Comparing version 3.1.2 to 3.2.0
# Change Log | ||
## [3.2.0](2018-05-17) | ||
### Added | ||
* Add support for opclass option in createIndex [#259](https://github.com/salsita/node-pg-migrate/pull/259) | ||
* Ability to specify extension schema [#260](https://github.com/salsita/node-pg-migrate/pull/260) | ||
## [3.1.2](2018-05-14) | ||
@@ -4,0 +11,0 @@ |
@@ -18,7 +18,8 @@ "use strict"; | ||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
ifNotExists = _ref.ifNotExists; | ||
ifNotExists = _ref.ifNotExists, | ||
schema = _ref.schema; | ||
if (!_lodash2.default.isArray(extensions)) extensions = [extensions]; // eslint-disable-line no-param-reassign | ||
return _lodash2.default.map(extensions, function (extension) { | ||
return _utils.template`CREATE EXTENSION${ifNotExists ? " IF NOT EXISTS" : ""} "${extension}";`; | ||
return _utils.template`CREATE EXTENSION${ifNotExists ? " IF NOT EXISTS" : ""} "${extension}"${schema ? ` SCHEMA "${schema}"` : ""};`; | ||
}); | ||
@@ -25,0 +26,0 @@ }; |
@@ -44,2 +44,3 @@ "use strict"; | ||
concurrently - | ||
opclass - name of an operator class | ||
options.method - [ btree | hash | gist | spgist | gin ] | ||
@@ -53,4 +54,5 @@ */ | ||
var where = options.where ? ` WHERE ${options.where}` : ""; | ||
var opclass = options.opclass ? ` ${options.opclass}` : ""; | ||
return _utils.template`CREATE ${unique} INDEX ${concurrently} "${indexName}" ON "${tableName}"${method} (${columnsString})${where};`; | ||
return _utils.template`CREATE ${unique} INDEX ${concurrently} "${indexName}" ON "${tableName}"${method} (${columnsString})${opclass}${where};`; | ||
}; | ||
@@ -57,0 +59,0 @@ |
@@ -10,2 +10,5 @@ # Extension Operations | ||
* `extension` _[string or array of strings]_ - name(s) of extensions to install | ||
* `options` _[object]_ - options: | ||
* `ifNotExists` _[boolean]_ - default `false` | ||
* `schema` _[string]_ - the name of the schema in which to install the extension's objects | ||
@@ -24,1 +27,4 @@ **Aliases:** `addExtension` | ||
* `extension` _[string or array of strings]_ - name(s) of extensions to install | ||
* `drop_options` _[object]_ - options: | ||
* `ifExists` _[boolean]_ - drops extension only if it exists | ||
* `cascade` _[boolean]_ - drops also dependent objects |
@@ -16,2 +16,3 @@ # Index Operations | ||
* `concurrently` _[boolean]_ - create this index concurrently | ||
* `opclass` _[string]_ - name of an operator class to use | ||
* `method` _[string]_ - btree | hash | gist | spgist | gin | ||
@@ -18,0 +19,0 @@ |
@@ -74,5 +74,11 @@ // Type definitions for node-pg-migrate | ||
concurrently?: boolean | ||
opclass?: string | ||
method?: 'btree' | 'hash' | 'gist' | 'spgist' | 'gin' | ||
} | ||
export interface CreateExtensionOptions { | ||
ifNotExists?: boolean | ||
schema?: string | ||
} | ||
export interface ColumnDefinitions { | ||
@@ -374,4 +380,4 @@ [name: string]: ColumnDefinition | string | ||
// Extensions | ||
createExtension(extension: string | string[], options?: { ifNotExists?: boolean }): void | ||
addExtension(extension: string | string[], options?: { ifNotExists?: boolean }): void | ||
createExtension(extension: string | string[], options?: CreateExtensionOptions): void | ||
addExtension(extension: string | string[], options?: CreateExtensionOptions): void | ||
dropExtension(extension: string | string[], dropOptions?: DropOptions): void | ||
@@ -378,0 +384,0 @@ |
{ | ||
"name": "node-pg-migrate", | ||
"version": "3.1.2", | ||
"version": "3.2.0", | ||
"description": "Postgresql database migration management tool for node.js", | ||
@@ -5,0 +5,0 @@ "author": "Theo Ephraim", |
206305
2539