简体   繁体   English

续集执行的迁移顺序

[英]Sequelize migration order of execution

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. 我理解Sequelize迁移和播种器是如何工作的,但是如果它们以某种特定顺序执行,我还没有发现任何状态。 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. 因此,如果我从数据库开始,进行一系列迁移,然后决定从原始起点初始化一个全新的数据库,它是否会以完全相同的顺序执行迁移。

I am using sequelize-cli to create migrations, so the file name does begin with a timestamp. 我使用sequelize-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 因此,当您使用CLI创建迁移并附加时间戳时,它会保证它将按创建顺序执行

Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM