Php 未创建Laravel迁移表
我是Laravel的新手。我按照教程创建了一个articles表。以下是我在/database/migrations/2017_02_13_145946_create_article_table.php中的部分代码Php 未创建Laravel迁移表,php,mysql,laravel-5,Php,Mysql,Laravel 5,我是Laravel的新手。我按照教程创建了一个articles表。以下是我在/database/migrations/2017_02_13_145946_create_article_table.php中的部分代码 public function up() { // Schema::create('articles', function(Blueprint $table) { $table->increments('id'); $tabl
public function up()
{
//
Schema::create('articles', function(Blueprint $table)
{
$table->increments('id');
$table->string('title');
$table->text('body')->nullable();
$table->integer('user_id');
$table->timestamps();
});
}
当我运行php artisan migrate
时,表没有创建。我用谷歌搜索了这个问题,然后运行php artisan migrate:reset
命令删除所有表。当我再次运行php artisan migate
命令时,它显示
Migrated: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrated: 2017_02_13_145946_create_article_table
但是没有创建任何内容,只更新了迁移记录表。表user
和password\u resets
也没有创建
你知道我做错了什么吗 我通常会尝试几种方法:
php artisan迁移:回滚
public函数down()
{
//投递物品表
Schema::drop('articles');
}
composer转储自动加载
显示数据库;
使用laravel_数据库:
展示表格代码>
删除表迁移代码>
php artisan迁移
显示表格代码>
AppServiceProvider.php
文件上写下这个
//edit:yrs:- Needed for edit
use Illuminate\Support\Facades\Schema;
将其写入boot方法中
//edit:yrs:-we can edit column sizefor tables here
Schema::defaultStringLength(150);
然后来到控制台并执行
*命令/>
php artisan migrate:status
并查看运行状态为y或n(如果为n),然后执行
*command />`php artisan migrate`
*command />`php artisan migrate:status` and then
*command />`php artisan migrate:refresh` and then
*command />`php artisan migrate:status`
这就是在mysql中创建表的所有步骤。如果显示迁移成功消息,则必须创建表,您是否检查了数据库中的迁移表以验证记录是否存在。@AkramWahid我已经检查了迁移表。列ID确实增加了。但是其他两个表没有生成。您能给我看一下迁移表的屏幕截图吗谢谢您的回复!我重新创建了这个项目,问题就解决了。