Zeichen's app for both server and client.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

26 rindas
774 B

  1. import models from './src/models'
  2. import seeds from './src/seeds'
  3. // TODO support NoSQL
  4. export const up = async queryInterface => {
  5. const createTablePromises = models.map(m => queryInterface.createTable(m.tableName, m.attributes))
  6. await Promise.all(createTablePromises)
  7. const seedTablePromise = models
  8. .filter(m => Boolean(seeds[m.modelName]))
  9. .map(m => {
  10. console.log(JSON.stringify(seeds[m.modelName]))
  11. return queryInterface.bulkInsert(m.tableName, seeds[m.tableName])
  12. })
  13. return Promise.all(seedTablePromise)
  14. }
  15. export const down = async queryInterface => {
  16. const dropTablePromises = models
  17. .reduce((reverse, m) => [m, ...reverse], [])
  18. .map(m => queryInterface.dropTable(m.tableName))
  19. return Promise.all(dropTablePromises)
  20. }