【问题标题】:How to create a new migration file under laravel-modules?如何在 laravel-modules 下新建迁移文件?
【发布时间】:2020-12-24 22:56:48
【问题描述】:

阅读 laravel-modules 如何为 laravel 6 工作
https://nwidart.com/laravel-modules/v6/advanced-tools/artisan-commands

我没有找到如何创建新的迁移文件。我尝试了两种方法,但都失败了:

root@95e2f26acdf8:/app/Modules/Opportunities# php artisan make:migration leads_table_add_test_id_fields --table=leads
Could not open input file: artisan
root@95e2f26acdf8:/app/Modules/Opportunities# php artisan make:migration Opportunities leads_table_add_test_id_fields --table=leads
Could not open input file: artisan


root@95e2f26acdf8:/app/Modules/Opportunities# cd ../
root@95e2f26acdf8:/app/Modules# cd ../
root@95e2f26acdf8:/app# php artisan make:migration Opportunities leads_table_add_test_id_fields --table=leads
  Too many arguments, expected arguments "command" "name".

修改

是的,那个命令

php artisan module:make-migration leads_table_add_test_fields Opportunities

工作正常。但我尝试将 --table= 选项添加为

php artisan module:make-migration leads_table_add_test_fields  Opportunities --table=opportunities 

但出现错误:

 The "--table" option does not exist.

?

哪种方式正确?

【问题讨论】:

  • php artisan module:make-migration module_name,请阅读所有文档
  • stackoverflow.com/a/57230550/9978078 请检查此答案以在特定文件夹中创建新迁移。
  • 请看已修改
  • nwidart 在我阅读时不支持额外的迁移命令

标签: laravel


【解决方案1】:

我认为你应该跑:

php artisan module:make-migration add_field_to_leads_table Opportunities

【讨论】:

    猜你喜欢
    • 2018-03-09
    • 2016-12-27
    • 2016-08-29
    • 1970-01-01
    • 2017-09-18
    • 2019-12-05
    • 2019-07-26
    • 2020-12-12
    • 2018-01-10
    相关资源
    最近更新 更多