aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0725-node-version.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/migrations/0725-node-version.ts')
-rw-r--r--server/initializers/migrations/0725-node-version.ts66
1 files changed, 66 insertions, 0 deletions
diff --git a/server/initializers/migrations/0725-node-version.ts b/server/initializers/migrations/0725-node-version.ts
new file mode 100644
index 000000000..d8b9cc750
--- /dev/null
+++ b/server/initializers/migrations/0725-node-version.ts
@@ -0,0 +1,66 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
7 db: any
8}): Promise<void> {
9 const { transaction } = utils
10
11 {
12 const data = {
13 type: Sequelize.STRING,
14 defaultValue: null,
15 allowNull: true
16 }
17 await utils.queryInterface.addColumn('application', 'nodeVersion', data, { transaction })
18 }
19
20 {
21 const data = {
22 type: Sequelize.STRING,
23 defaultValue: null,
24 allowNull: true
25 }
26 await utils.queryInterface.addColumn('application', 'nodeABIVersion', data, { transaction })
27 }
28
29 {
30 const query = `UPDATE "application" SET "nodeVersion" = '${process.version}'`
31 await utils.sequelize.query(query, { transaction })
32 }
33
34 {
35 const nodeABIVersion = parseInt(process.versions.modules)
36 const query = `UPDATE "application" SET "nodeABIVersion" = ${nodeABIVersion}`
37 await utils.sequelize.query(query, { transaction })
38 }
39
40 {
41 const data = {
42 type: Sequelize.STRING,
43 defaultValue: null,
44 allowNull: false
45 }
46 await utils.queryInterface.changeColumn('application', 'nodeVersion', data, { transaction })
47 }
48
49 {
50 const data = {
51 type: Sequelize.STRING,
52 defaultValue: null,
53 allowNull: false
54 }
55 await utils.queryInterface.changeColumn('application', 'nodeABIVersion', data, { transaction })
56 }
57}
58
59function down (options) {
60 throw new Error('Not implemented.')
61}
62
63export {
64 up,
65 down
66}