php - 如何以自定义顺序运行迁移

标签 php laravel database-migration

例如。我有两个表,checkers 表和users 表。

我想首先迁移 users 表,因为 checkers 表在“users”表上有一个外键,但 checkers 表执行第一的。

我使用php artisan migrate命令。

我必须先手动运行users 表还是有更好的方法?

-> Laravel Foreign Key Documentation

最佳答案

刚找到答案。

The number before the migration file name is a date time, make your user migration and earlier time and your should be good

Source - http://forumsarchive.laravel.io/viewtopic.php?id=10246

关于php - 如何以自定义顺序运行迁移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27677048/

相关文章:

php - 选择 like but 作为分隔符之间的整个字符串

mysql - SQLSTATE[HY000] : General error: 1364 Field 'name' doesn't have a default value, Laravel

django - django 中的 makemigrations 损坏

mysql - 无法迁移 MySQL 数据库

php - PHP 中 XPath 的 'undefined namespace prefix' 问题?

php - PDO 数组从 MySQL 查询到插入查询

javascript - 使用沙箱/隔离执行 sql 查询

php - Laravel 加入查询

laravel - 在 Amazon RDS 上部署 Multi-Tenancy (每个租户都有单独的数据库)

java - Envers 如何处理架构更改?