Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function up()
- {
- Schema::create('location_areas', function (Blueprint $table) {
- $table->smallIncrements('id', 4)->unsigned();
- $table->string('name', 50)->unique();
- $table->smallInteger('location_region_id', 4)->unsigned();
- $table->foreign('location_region_id')->references('id')
- ->on('location_regions')->onDelete('cascade');
- $table->engine = 'InnoDB';
- $table->charset = 'utf8';
- $table->collation = 'utf8_general_ci';
- });
- }
- Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key (SQL: create table `location_areas` (`id` smallint unsigned not null auto_increment primary key, `name` varchar(50) not null, `location_region_id` smallint unsigned not null auto_increment primary key) default character set utf8 collate 'utf8_general_ci' engine = InnoDB)
- Если убрать ограничения, то все работает как надо.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement