When I try database migrations Scheme Builder from Laravel.
When I enter a type integer, auto_increment and primary key are automatically inputed.
I don't know how to get a create table in laravel.
Schema::create('tbl_corona_region', function(Blueprint $table){
$table->string('seq', 30);
$table->date('create_dt');
$table->string('region_nm', 30);
$table->string('region_cn', 30);
$table->string('region_en', 30);
$table->integer('defCnt', 15)->default(0);
$table->integer('incDec', 15)->default(0);
$table->integer('deathCnt', 15)->default(0);
$table->integer('isolIngCnt', 15)->default(0);
$table->integer('isolClearCnt', 15)->default(0);
$table->integer('localOccCnt', 15)->default(0);
$table->integer('overFlowCnt', 15)->default(0);
$table->integer('qurRate', 15)->default(0);
$table->dateTime('stdDay');
$table->dateTime('update_dt');
$table->primary(['seq', 'create_dt', 'region_nm']);
});
Generates this SQL
create table `tbl_corona_region` (
`seq` varchar(30) not null,
`create_dt` date not null,
`region_nm` varchar(30) not null,
`region_cn` varchar(30) not null,
`region_en` varchar(30) not null,
`defCnt` int not null default '0' auto_increment primary key,
`incDec` int not null default '0' auto_increment primary key,
`deathCnt` int not null default '0' auto_increment primary key,
`isolIngCnt` int not null default '0' auto_increment primary key,
`isolClearCnt` int not null default '0' auto_increment primary key,
`localOccCnt` int not null default '0' auto_increment primary key,
`overFlowCnt` int not null default '0' auto_increment primary key,
`qurRate` int not null default '0' auto_increment primary key,
`stdDay` datetime not null,
`update_dt` datetime not null
) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
$table->integer('defCnt', 15)->default(0)would make this field autoincrement and primary?integerthough I'm not sure the 2nd parameter should be used there. Can you share the exact Laravel version you are using?