2
1

0115-account-avatar.ts 569 B

123456789101112131415161718192021222324252627282930
  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. await utils.db.Avatar.sync()
  9. const data = {
  10. type: Sequelize.INTEGER,
  11. allowNull: true,
  12. references: {
  13. model: 'Avatars',
  14. key: 'id'
  15. },
  16. onDelete: 'CASCADE'
  17. }
  18. await utils.queryInterface.addColumn('Accounts', 'avatarId', data)
  19. }
  20. function down (options) {
  21. throw new Error('Not implemented.')
  22. }
  23. export {
  24. up,
  25. down
  26. }