-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reduce duplicated code for data migrations #433
Conversation
connection = await pool.getConnection() | ||
for (const statement of this._upCommands) { | ||
console.log(`[DB] Execute: ${statement}`) | ||
connection.query(statement) |
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.
Missing await
await connection.query(statement)
connection = await pool.getConnection() | ||
for (const statement of this._downCommands) { | ||
console.log(`[DB] Execute: ${statement}`) | ||
connection.query(statement) |
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.
Missing await
await connection.query(statement)
finally { | ||
await connection.release() | ||
} | ||
migrationHandler.up(pool, __filename) |
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.
Need await
await migrationHandler.up(pool, __filename)
finally { | ||
await connection.release() | ||
} | ||
migrationHandler.down(pool, __filename) |
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.
Need await
await migrationHandler.up(pool, __filename)
finally { | ||
await connection.release() | ||
} | ||
migrationHandler.up(pool, __filename) |
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.
Need await
await migrationHandler.up(pool, __filename)
finally { | ||
await connection.release() | ||
} | ||
migrationHandler.down(pool, __filename) |
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.
Need await
await migrationHandler.up(pool, __filename)
finally { | ||
await connection.release() | ||
} | ||
migrationHandler.up(pool, __filename) |
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.
Need await
await migrationHandler.up(pool, __filename)
finally { | ||
await connection.release() | ||
} | ||
migrationHandler.down(pool, __filename) |
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.
Need await
await migrationHandler.up(pool, __filename)
@@ -1,4 +1,4 @@ | |||
const path = require('path') | |||
const MigrationHandler = require('../migrationHandler') |
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.
incorrect case:
require('../MigrationHandler')
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.
When class file is relocated, please adjust require
:
const MigrationHandler = require('./lib/MigrationHandler')
@@ -1,4 +1,4 @@ | |||
const path = require('path') | |||
const MigrationHandler = require('../migrationHandler') |
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.
incorrect case:
require('../MigrationHandler')
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.
When class file is relocated, please adjust require
:
const MigrationHandler = require('./lib/MigrationHandler')
@@ -0,0 +1,51 @@ | |||
"use strict"; |
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.
Please place this file at api/source/service/mysql/migrations/lib/MigrationHandler.js
@@ -1,4 +1,4 @@ | |||
const path = require('path') | |||
const MigrationHandler = require('../MigrationHandler') |
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.
When class file is relocated, please adjust require
:
const MigrationHandler = require('./lib/MigrationHandler')
resolves #432