ニジカ投稿局 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.

0510-video-file-metadata.ts 980 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import * as Sequelize from 'sequelize'
  2. async function up (utils: {
  3. transaction: Sequelize.Transaction
  4. queryInterface: Sequelize.QueryInterface
  5. sequelize: Sequelize.Sequelize
  6. }): Promise<void> {
  7. // We made a mistake with the migration in 2.2.0-rc.1
  8. // Docker containers did not include this migration file
  9. // So we check the table definition and add the column if it does not exist
  10. const tableDefinition = await utils.queryInterface.describeTable('videoFile')
  11. if (!tableDefinition['metadata']) {
  12. const metadata = {
  13. type: Sequelize.JSONB,
  14. allowNull: true
  15. }
  16. await utils.queryInterface.addColumn('videoFile', 'metadata', metadata)
  17. }
  18. if (!tableDefinition['metadataUrl']) {
  19. const metadataUrl = {
  20. type: Sequelize.STRING,
  21. allowNull: true
  22. }
  23. await utils.queryInterface.addColumn('videoFile', 'metadataUrl', metadataUrl)
  24. }
  25. }
  26. function down (options) {
  27. throw new Error('Not implemented.')
  28. }
  29. export {
  30. up,
  31. down
  32. }