【发布时间】:2023-03-18 22:15:01
【问题描述】:
我正在尝试在 Laravel 5 中创建 mysql 表。我在 /project/database/migrations 中创建了一个名为 users.php 的文件:
[...]
public function up()
{
Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
$table->string('username');
$table->string('fullname');
$table->int('number');
$table->string('email')->unique();
$table->string('password', 60);
$table->rememberToken();
$table->timestamps();
});
}
[...]
然后我尝试在project-文件夹中运行这些命令:
$ php artisan migrate
$ php artisan migrate:install
$ php artisan migrate --pretend
它们都没有返回 any 输出,也没有创建表。要填充的数据库已存在。
【问题讨论】:
-
请使用这个命令
php artisan make:migration CreateUsersTable --create创建迁移然后运行php artisan migrate
标签: php laravel laravel-5 laravel-artisan laravel-migrations