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

58 lines
1.6 KiB

  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. {
  9. const query = `
  10. CREATE TABLE IF NOT EXISTS "userRegistration" (
  11. "id" serial,
  12. "state" integer NOT NULL,
  13. "registrationReason" text NOT NULL,
  14. "moderationResponse" text,
  15. "password" varchar(255),
  16. "username" varchar(255) NOT NULL,
  17. "email" varchar(400) NOT NULL,
  18. "emailVerified" boolean,
  19. "accountDisplayName" varchar(255),
  20. "channelHandle" varchar(255),
  21. "channelDisplayName" varchar(255),
  22. "userId" integer REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
  23. "createdAt" timestamp with time zone NOT NULL,
  24. "updatedAt" timestamp with time zone NOT NULL,
  25. PRIMARY KEY ("id")
  26. );
  27. `
  28. await utils.sequelize.query(query, { transaction: utils.transaction })
  29. }
  30. {
  31. await utils.queryInterface.addColumn('userNotification', 'userRegistrationId', {
  32. type: Sequelize.INTEGER,
  33. defaultValue: null,
  34. allowNull: true,
  35. references: {
  36. model: 'userRegistration',
  37. key: 'id'
  38. },
  39. onUpdate: 'CASCADE',
  40. onDelete: 'SET NULL'
  41. }, { transaction: utils.transaction })
  42. }
  43. }
  44. async function down (utils: {
  45. queryInterface: Sequelize.QueryInterface
  46. transaction: Sequelize.Transaction
  47. }) {
  48. await utils.queryInterface.dropTable('videoChannelSync', { transaction: utils.transaction })
  49. }
  50. export {
  51. up,
  52. down
  53. }