Sequelize 迁移执行顺序 [英] Sequelize migration order of execution

查看:24
本文介绍了Sequelize 迁移执行顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎无法在任何地方找到答案.我了解 Sequelize 迁移和播种机的工作原理,但我没有找到任何说明它们是否以特定顺序执行的地方.因此,如果我从一个数据库开始,进行一堆迁移,然后决定从原始起点初始化一个全新的数据库,它是否会以完全相同的顺序执行迁移.

I can't seem to find the answer to this anywhere. I understand how Sequelize migrations and seeder work, but I have not found anywhere that states if they execute in some particular order. So if I start with a database, make a bunch of migrations, and then decide to initialize a brand new database from the original start point, will it execute the migrations in the exact same order.

我使用 sequelize-cli 创建迁移,因此文件名确实以时间戳开头.

I am using sequelize-cli to create migrations, so the file name does begin with a timestamp.

推荐答案

对于将来看到此内容的任何人,它会按照文件夹的默认排序顺序执行.因此,当您使用 CLI 创建迁移并附加时间戳时,它保证它将按照创建顺序执行

For anyone that sees this in the future, it executes in the default sort order of the folder. So when you use the CLI to create a migration and it appends the timestamp, it guarantees that it will execute in the order they were created

希望能帮到你

这篇关于Sequelize 迁移执行顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆