Having used the appropriate artisan
commands:
php artisan make:model VenuesGeoNations --migration
... and:
php artisan make:model VenuesGeoRegions --migration
I created the schema:
Schema::create('venues_geo_nations', function (Blueprint $table) {
$table->increments('id');
$table->string('nation');
$table->string('iso');
$table->timestamps();
});
... and:
Schema::create('venues_geo_regions', function (Blueprint $table) {
$table->increments('id');
$table->string('towns_cities');
$table->string('regions');
$table->string('nations');
$table->mediumInteger('venues_geo_nation_id')->unsigned();
$table->foreign('venues_geo_nation_id')->references('id')->on('venues_geo_nations');
$table->timestamps();
});
However, when I run the migration
command, I get the error:
[Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint...
... on the venues_geo_regions
table, in spite of the correct execution order.
I've also tried executing in the reverse order and I get the same error.
Compounding things is the fact that each rollback
wipes out the tables for Voyager, and if it wasn't for snapshots on the EC2 instance I'm using, I'd have gone mad before now.
At this stage I'm a bit lost, and have to assume I'm doing something wrong.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2tBmgHD
via IFTTT
Aucun commentaire:
Enregistrer un commentaire