Skip to content

Commit

Permalink
Add 'renameTable' function
Browse files Browse the repository at this point in the history
  • Loading branch information
dxg committed Mar 17, 2022
1 parent 45c46e1 commit d533d72
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 197 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v4.3.0
- Add `renameTable`

### v4.2.0
- Add MySQL & PostgreSQL `defaultExpression` to allow setting default values via DB functions
- MySQL: `id: { type : 'text', key: true, defaultExpression: 'uuid()' }` (requires MySQL 8.0.13+)
Expand Down
11 changes: 6 additions & 5 deletions lib/migration-dsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ MigrationDSL.prototype = {
}
),

renameTable: addPromiseInterface(
function (collectionName, newCollectionName, cb) {
this.Dialect.renameCollection(this.driver, collectionName, newCollectionName, cb);
}
),

addColumn: addPromiseInterface(
function (collectionName, options, cb) {
var columnName = _.keys(options)[0]
Expand Down Expand Up @@ -169,11 +175,6 @@ MigrationDSL.prototype = {
this.driver.execQuery(query, args, cb);
}
)

// comment out for now
// , renameTable: function(oldCollectionName, newCollectionName, cb){
// this.Dialect.renameTable(this.driver, oldCollectionName, newCollectionName, cb);
// }
};

module.exports = MigrationDSL;
Loading

0 comments on commit d533d72

Please sign in to comment.