ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0725-node-version.ts 1.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import * as Sequelize from 'sequelize'
  2. async function up (utils: {
  3. transaction: Sequelize.Transaction
  4. queryInterface: Sequelize.QueryInterface
  5. sequelize: Sequelize.Sequelize
  6. db: any
  7. }): Promise<void> {
  8. const { transaction } = utils
  9. {
  10. const data = {
  11. type: Sequelize.STRING,
  12. defaultValue: null,
  13. allowNull: true
  14. }
  15. await utils.queryInterface.addColumn('application', 'nodeVersion', data, { transaction })
  16. }
  17. {
  18. const data = {
  19. type: Sequelize.STRING,
  20. defaultValue: null,
  21. allowNull: true
  22. }
  23. await utils.queryInterface.addColumn('application', 'nodeABIVersion', data, { transaction })
  24. }
  25. {
  26. const query = `UPDATE "application" SET "nodeVersion" = '${process.version}'`
  27. await utils.sequelize.query(query, { transaction })
  28. }
  29. {
  30. const nodeABIVersion = parseInt(process.versions.modules)
  31. const query = `UPDATE "application" SET "nodeABIVersion" = ${nodeABIVersion}`
  32. await utils.sequelize.query(query, { transaction })
  33. }
  34. {
  35. const data = {
  36. type: Sequelize.STRING,
  37. defaultValue: null,
  38. allowNull: false
  39. }
  40. await utils.queryInterface.changeColumn('application', 'nodeVersion', data, { transaction })
  41. }
  42. {
  43. const data = {
  44. type: Sequelize.STRING,
  45. defaultValue: null,
  46. allowNull: false
  47. }
  48. await utils.queryInterface.changeColumn('application', 'nodeABIVersion', data, { transaction })
  49. }
  50. }
  51. function down (options) {
  52. throw new Error('Not implemented.')
  53. }
  54. export {
  55. up,
  56. down
  57. }