【问题标题】:How can i delete a migration that is not found? [duplicate]如何删除未找到的迁移? [复制]
【发布时间】:2022-01-04 19:36:10
【问题描述】:

我有这个问题

当我运行php artisan migrate:refresh:

Rolling back: 2014_10_12_100000_create_password_resets_table
Rolled back:  2014_10_12_100000_create_password_resets_table (1.71ms)
Rolling back: 2014_10_12_000000_create_users_table
Rolled back:  2014_10_12_000000_create_users_table (1.76ms)
Migration not found: 2018_06_30_113500_create_comments_table <---- THIS ONE!!!
Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table (8.18ms)

我已经试过了:

php artisan migrate:refresh

php artisan migrate:rollback --step=1 直到我得到:"Migration not found: 2018_06_30_113500_create_comments_table"

我怎样才能删除这个:

迁移文件"2018_06_30_113500_create_comments_table"?

【问题讨论】:

  • 你检查过版本历史吗?是否有人忘记签入文件2018_06_30_113500_create_comments_table
  • @MaartenDev 此迁移文件属于损坏的包。我已经删除了这个包,并且我尝试过的 git 分支不再存在。
  • 你也注销了这个包吗?
  • @MaartenDev 首先从 composer.json 中删除,然后是 composer install。然后删除整个供应商文件夹并再次安装作曲家。
  • 您是否尝试清除数据库中的migrations 表?

标签: laravel


【解决方案1】:

这可以通过手动删除migrations 表中的2018_06_30_113500_create_comments_table 记录来解决。您可以使用以下命令:

DELETE FROM migrations where name = '2018_06_30_113500_create_comments_table'

【讨论】:

    猜你喜欢
    • 2016-04-02
    • 1970-01-01
    • 2020-01-20
    • 2015-09-13
    • 2021-11-07
    • 1970-01-01
    • 2015-12-07
    • 2018-02-22
    • 1970-01-01
    相关资源
    最近更新 更多