Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added mobiledoc_revisions schema, migration script and updated tests
- Loading branch information
1 parent
96488af
commit 91f8e03
Showing
4 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
core/server/data/migrations/versions/2.2/5-add-mobiledoc-revisions-table.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const common = require('../../../../lib/common'); | ||
const commands = require('../../../schema').commands; | ||
const table = 'mobiledoc_revisions'; | ||
const message1 = 'Adding table: ' + table; | ||
const message2 = 'Dropping table: ' + table; | ||
|
||
module.exports.up = (options) => { | ||
const connection = options.connection; | ||
|
||
return connection.schema.hasTable(table) | ||
.then(function (exists) { | ||
if (exists) { | ||
common.logging.warn(message1); | ||
return; | ||
} | ||
|
||
common.logging.info(message1); | ||
return commands.createTable(table, connection); | ||
}); | ||
}; | ||
|
||
module.exports.down = (options) => { | ||
const connection = options.connection; | ||
|
||
return connection.schema.hasTable(table) | ||
.then(function (exists) { | ||
if (!exists) { | ||
common.logging.warn(message2); | ||
return; | ||
} | ||
|
||
common.logging.info(message2); | ||
return commands.deleteTable(table, connection); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91f8e03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reference was not added.
This commit refs #9927.