node-pg-migrate
Advanced tools
Comparing version 2.4.0 to 2.5.0
# Change Log | ||
## [2.5.0] (2017-07-19) | ||
### Added | ||
- USING clasue in alter column #99 | ||
- Role operations #100 | ||
## [2.4.0] (2017-07-17) | ||
@@ -4,0 +11,0 @@ |
@@ -34,2 +34,6 @@ 'use strict'; | ||
var _roles = require('./operations/roles'); | ||
var roles = _interopRequireWildcard(_roles); | ||
var _other = require('./operations/other'); | ||
@@ -98,2 +102,7 @@ | ||
this.createRole = wrap(roles.create); | ||
this.dropRole = wrap(roles.drop); | ||
this.alterRole = wrap(roles.alter); | ||
this.renameRole = wrap(roles.rename); | ||
this.sql = wrap(other.sql); | ||
@@ -100,0 +109,0 @@ |
@@ -145,3 +145,4 @@ 'use strict'; | ||
if (options.type) { | ||
actions.push(`SET DATA TYPE ${applyTypeAdapters(options.type)}`); | ||
var action = `SET DATA TYPE ${applyTypeAdapters(options.type)}`; | ||
actions.push(options.using ? `${action} USING ${options.using}` : action); | ||
} | ||
@@ -148,0 +149,0 @@ if (options.notNull) { |
@@ -22,3 +22,3 @@ { | ||
], | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"engines": { | ||
@@ -25,0 +25,0 @@ "node": ">=4.0.0" |
107
README.md
@@ -249,2 +249,3 @@ # pg-migrate | ||
- `notNull` _[boolean]_ - sets NOT NULL if true | ||
- `using` _[string]_ - adds USING clause to change values in column | ||
@@ -308,25 +309,4 @@ ----------------------------------------------------- | ||
### Miscellaneous Operations | ||
### Extension Operations | ||
#### `pgm.sql( sql )` | ||
> Run raw sql -- with some optional _[very basic](http://mir.aculo.us/2011/03/09/little-helpers-a-tweet-sized-javascript-templating-engine/)_ mustache templating | ||
**Arguments:** | ||
- `sql` _[string]_ - SQL query to run | ||
- `args` _[object]_ - (optional) key/val of arguments to replace | ||
----------------------------------------------------- | ||
#### `pgm.func( sql )` | ||
> Inserts raw string, which is not escaped | ||
e.g. `pgm.func('CURRENT_TIMESTAMP')` to use in `default` option for column definition | ||
**Arguments:** | ||
- `sql` _[string]_ - string to not be escaped | ||
----------------------------------------------------- | ||
#### `pgm.createExtension( extension )` | ||
@@ -353,5 +333,6 @@ | ||
### Type Operations | ||
#### `pgm.createType( type_name, values )` | ||
> Create a new data type - [postgres docs](http://www.postgresql.org/docs/current/static/sql-createtype.html) | ||
@@ -377,2 +358,82 @@ | ||
### Role Operations | ||
#### `pgm.createRole( role_name, role_options )` | ||
> Create a new role - [postgres docs](http://www.postgresql.org/docs/current/static/sql-createrole.html) | ||
**Arguments:** | ||
- `role_name` _[string]_ - name of the new role | ||
- `role_options` _[object]_ - options: | ||
- `superuser` _[boolean]_ - default false | ||
- `createdb` _[boolean]_ - default false | ||
- `createrole` _[boolean]_ - default false | ||
- `inherit` _[boolean]_ - default true | ||
- `login` _[boolean]_ - default false | ||
- `replication` _[boolean]_ - default false | ||
- `bypassrls` _[boolean]_ | ||
- `limit` _[number]_ - | ||
- `password` _[string]_ - | ||
- `encrypted` _[boolean]_ - default true | ||
- `valid` _[string]_ - timestamp | ||
- `inRole` _[string or array]_ - role or array of roles | ||
- `role` _[string or array]_ - role or array of roles | ||
- `admin` _[string or array]_ - role or array of roles | ||
**Reverse Operation:** `dropRole` | ||
----------------------------------------------------- | ||
#### `pgm.dropRole( role_name )` | ||
> Drop a role - [postgres docs](http://www.postgresql.org/docs/current/static/sql-droprole.html) | ||
**Arguments:** | ||
- `role_name` _[string]_ - name of the new role | ||
----------------------------------------------------- | ||
#### `pgm.alterRole( role_name, role_options )` | ||
> Alters a role - [postgres docs](http://www.postgresql.org/docs/current/static/sql-alterrole.html) | ||
**Arguments:** | ||
- `role_name` _[string]_ - name of the new role | ||
- `role_options` _[object]_ - [see](#pgmcreaterole-role_name-role_options-) | ||
----------------------------------------------------- | ||
#### `pgm.renameRole( old_role_name, new_role_name )` | ||
> Alters a role - [postgres docs](http://www.postgresql.org/docs/current/static/sql-alterrole.html) | ||
**Arguments:** | ||
- `old_role_name` _[string]_ - old name of the role | ||
- `new_role_name` _[string]_ - new name of the role | ||
----------------------------------------------------- | ||
### Miscellaneous Operations | ||
#### `pgm.sql( sql )` | ||
> Run raw sql -- with some optional _[very basic](http://mir.aculo.us/2011/03/09/little-helpers-a-tweet-sized-javascript-templating-engine/)_ mustache templating | ||
**Arguments:** | ||
- `sql` _[string]_ - SQL query to run | ||
- `args` _[object]_ - (optional) key/val of arguments to replace | ||
----------------------------------------------------- | ||
#### `pgm.func( sql )` | ||
> Inserts raw string, which is not escaped | ||
e.g. `pgm.func('CURRENT_TIMESTAMP')` to use in `default` option for column definition | ||
**Arguments:** | ||
- `sql` _[string]_ - string to not be escaped | ||
----------------------------------------------------- | ||
### Column Definitions | ||
@@ -379,0 +440,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
899
486
92874
28