在Laravel 5.1软件包中将移植放在何处? [英] Where to put migration within a Laravel 5.1 package?

查看:96
本文介绍了在Laravel 5.1软件包中将移植放在何处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗯,我确实有一个软件包,只能与系统一起使用.我确实有该软件包的迁移(它是基于Laravel 4.2构建的,并且我正在对其进行升级).

Well, I do have a package take I only use alongside with my system. I do have migrations for that package (it was build on Laravel 4.2, and I'm upgrading it).

话虽如此:在我的程序包上(以前的工作台)在Laravel 5.1上,我应该放在哪里以及如何运行迁移?

That being said: On my package (former workbench) on Laravel 5.1, where do I put and how do I run my migrations?

你们中有人知道如何处理吗?

Does any of you guys know how to deal with this?

更新:

这不是简单迁移的情况.回到laravel 4. *,我们能够维护每个程序包的迁移(如果需要的话),而且我确实有一些迁移是由我自己的程序包进行的,它在自己的数据库中,并在自己的表中.所以...我需要它是 PACKAGE 的迁移,而不是 ROOT INSTALATION 的迁移.

This is not the case of a simple migration. Back on laravel 4.*, we were able to maintain migrations for each package (if it was so desirable), and I do have some migrations been held by my own package, in it's own database, with it's own table. So... I need it to be a PACKAGE's migrations and not a ROOT INSTALATION's migration.

推荐答案

您可以将其放在packages/.../src/migrations中. 要运行它:

You can put it in packages/.../src/migrations. To run it:

  1. 您可以插入composer.json中:

"autoload": { "classmap": [ "database", "packages/.../src/migrations" ],

"autoload": { "classmap": [ "database", "packages/.../src/migrations" ],

  1. 或致电:

  1. Or just call :

  • Laravel 4.x php artisan migrate --package="{vendor}/{name}"
  • Laravel 5.x php artisan migrate --path=/packages/.../migrations
  • Laravel 4.x php artisan migrate --package="{vendor}/{name}"
  • Laravel 5.x php artisan migrate --path=/packages/.../migrations

更多信息:请检查 查看全文

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