2
1

0535-video-live.ts 861 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. {
  8. const query = `
  9. CREATE TABLE IF NOT EXISTS "videoLive" (
  10. "id" SERIAL ,
  11. "streamKey" VARCHAR(255),
  12. "videoId" INTEGER NOT NULL REFERENCES "video" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
  13. "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL,
  14. "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL,
  15. PRIMARY KEY ("id")
  16. );
  17. `
  18. await utils.sequelize.query(query)
  19. }
  20. {
  21. await utils.queryInterface.addColumn('video', 'isLive', {
  22. type: Sequelize.BOOLEAN,
  23. defaultValue: false,
  24. allowNull: false
  25. })
  26. }
  27. }
  28. function down (options) {
  29. throw new Error('Not implemented.')
  30. }
  31. export {
  32. up,
  33. down
  34. }