未找到 Laravel 4 迁移基表
问题描述
我正在尝试制作以下教程:https://medium.com/on-coding/e8d93c9ce0e2
I'm trying to make following tutorial: https://medium.com/on-coding/e8d93c9ce0e2
当谈到运行时:
我收到以下错误:
数据库连接正常,迁移表创建成功.如您在错误消息中所见,数据库名称已更改.
Database connection is working, the migrations table was created successfully. Database name was changed as you can see in the error message.
对我来说很奇怪的是,它试图改变表——它不存在——而不是创建它.
Whats quite strange to me, is that it tries to alter the table - which doesn't exists - and not to create it.
这是我的其他文件,例如 UserModel、Seeder、Miggation 和 DB Config.
Here are my other files, like UserModel, Seeder, Migtation and DB Config.
创建用户表:
用户模型:
用户种子:
数据库播种机:
数据库配置:
希望有人可以在这里给我一个提示.
Hope somebody can give me a hint here.
最好的问候 ihkawiss
Best regards ihkawiss
推荐答案
在你的 CreateUserTable
迁移文件中,你必须使用 而不是
.Schema::table
Schema::create
In your CreateUserTable
migration file, instead of Schema::table
you have to use Schema::create
.
Schema::table
用于更改现有表,Schema::create
用于创建新表.
The Schema::table
is used to alter an existing table and the Schema::create
is used to create new table.
查看文档:
- http://laravel.com/docs/schema#creating-and-dropping-tables
- http://laravel.com/docs/schema#adding-columns
所以您的用户迁移将是:
So your user migration will be:
这篇关于未找到 Laravel 4 迁移基表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!