【发布时间】:2017-07-02 04:53:25
【问题描述】:
我是 Laravel 的新手。我按照教程创建了一个文章表。这是我在 /database/migrations/2017_02_13_145946_create_article_table.php 中的部分代码
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_resets也没有创建。
任何想法我可能做错了什么?
【问题讨论】:
-
如果它显示迁移成功消息那么必须创建表,您是否检查了数据库中的迁移表以验证记录是否存在..
-
@AkramWahid 我检查了迁移表。列 ID 确实增加了。但其他两个表没有生成。
-
你能给我看看你的迁移表的截图吗