Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created session table migration (#9908)
refs #9865 - This table will be used for storing user sessions in
- Loading branch information
Showing
4 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
core/server/data/migrations/versions/2.2/1-add-sessions-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 = 'sessions'; | ||
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