【问题标题】:Laravel run package migration by composer update automaticLaravel 通过 composer update 自动运行包迁移
【发布时间】:2018-02-05 15:35:22
【问题描述】:

我有一个包,我的 ServiceProvider 复制了迁移。这在 php artisan 迁移后工作正常。但是现在我想在作曲家更新名称/名称包时执行包迁移。 所以,php artisan 更新 name/packagename 并直接自动迁移。

我怎样才能做到这一点?

$this->publishes([
    __DIR__ . '/database/migrations' => $this->app->databasePath() . '/migrations'
], 'migrations');

【问题讨论】:

  • 是否需要在任何包更新或特定包更新后运行迁移?
  • @AlexG。在作曲家更新后直接。所以在包裹的某个地方?

标签: laravel-5


【解决方案1】:

在应用程序(不是包)composer.json中

"scripts": {
"post-update-cmd": [
    "php artisan optimize",
    "php artisan migrate"
    ]
}

命令的顺序由您决定。此外,您可以创建一个命令或使用php artisan vendor:publish --provider=... 来移动迁移

【讨论】:

  • 这是在应用程序composer.json还是包中?
猜你喜欢
  • 2013-05-24
  • 2016-10-13
  • 2016-10-23
  • 2016-10-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-05-31
  • 2018-09-22
相关资源
最近更新 更多