【发布时间】:2019-01-23 01:15:32
【问题描述】:
我尝试在 Laravel 中迁移两个表 数据库:PostgreSQL
Schema::create('paises', function (Blueprint $table) {
$table->bigincrements('id');
$table->string('descripcion', 50);
$table->string('abreviatura',3)->nullable();
$table->string('genticilio',60)->nullable();
$table->string('usuario_creacion', 20);
$table->dateTime('fecha_creacion');
$table->string('usuario_modificacion',20)->nullable();
$table->dateTime('fecha_modificacion')->nullable();
});
Schema::create('provincias_departamentos', function (Blueprint $table) {
$table->bigincrements('id');
$table->string('descripcion', 50);
$table->string('abreviatura',3)->nullable();
$table->string('genticilio',60)->nullable();
$table->unsignedBigInteger('id_pais');
$table->foreign('id_pais')->references('id')->on('paises');
$table->string('usuario_creacion', 20);
$table->dateTime('fecha_creacion');
$table->string('usuario_modificacion',20)->nullable();
$table->dateTime('fecha_modificacion')->nullable();
});
我在进行迁移时没有出错,但是在验证数据库中某个基础的密钥时,找不到它们。 在迁移时登录:
Migrating: 2019_01_01_000001_crear_tabla_paises
Migrated: 2019_01_01_000001_crear_tabla_paises
Migrating: 2019_01_01_000002_crear_tabla_provincias_depatarmentos
Migrated: 2019_01_01_000002_crear_tabla_provincias_depatarmentos
【问题讨论】:
-
您好@Fed3x,如果您包含您遇到的错误将会很有帮助。不太清楚你在问什么。
标签: laravel postgresql foreign-keys migration