public function up()
{
Schema::create('articles', function (Blueprint $table) {
$table->increments('id');
$table->string('login_id');
$table->string('role');
$table->string('name');
$table->string('password');
$table->string('mail');
$table->string('updated_person');
$table->timestamps();
});
}
[vagrant@localhost laravel]$ php artisan migrate
Migration table created successfully.
Migrating: 2018_09_19_234806_create_articles_table
Migrated: 2018_09_19_234806_create_articles_table
.env
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=laravel57 DB_USERNAME=root DB_PASSWORD=
table.php
{
Schema::create('articles', function (Blueprint $table) {
$table->increments('id');
$table->string('login_id');
$table->string('role');
$table->string('name');
$table->string('password');
$table->string('mail');
$table->string('test_mail');
$table->string('updated_person');
$table->timestamps();
});
}
mysql> show columns from articles
-> ;
+—————-+——————+——+—–+———+—————-+
| Field | Type | Null | Key | Default | Extra |
+—————-+——————+——+—–+———+—————-+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| login_id | varchar(255) | NO | | NULL | |
| role | varchar(255) | NO | | NULL | |
| name | varchar(255) | NO | | NULL | |
| password | varchar(255) | NO | | NULL | |
| mail | varchar(255) | NO | | NULL | |
| test_mail | varchar(255) | NO | | NULL | |
| updated_person | varchar(255) | NO | | NULL | |
| created_at | timestamp | YES | | NULL | |
| updated_at | timestamp | YES | | NULL | |
+—————-+——————+——+—–+———+—————-+
10 rows in set (0.00 sec)
increments(”)だとint(10) primary key auto_increment, string(”)だとvarchar(255)になりますね。