I am trying to use a Laravel (v5.2.45) DB Seeder to initiate a lookups table in a Postgres DB.
When I run it, I get this output:
[Illuminate\Database\QueryException]
SQLSTATE[42703]: Undefined column: 7 ERROR: column "lkup_type" of relation "syslookups" does not exist
LINE 1: insert into "syslookups" ("lkup_type", "lkup_text") values (...
^ (SQL: insert into "syslookups" ("lkup_type", "lkup_text") values (0, Employee))
Here's the seeder code:
<?php
use Illuminate\Database\Seeder;
class SyslookupsSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('syslookups')->delete();
DB::table('syslookups')->insert(
['lkup_type'=>0, 'lkup_text'=>"Employee"],
['lkup_type'=>0, 'lkup_text'=>"Member"],
['lkup_type'=>1, 'lkup_text'=>"Open"],
['lkup_type'=>1, 'lkup_text'=>"Closed"],
// .. many more here
['lkup_type'=>5, 'lkup_text'=>"Yes"],
['lkup_type'=>5, 'lkup_text'=>"No"],
['lkup_type'=>6, 'lkup_text'=>"Work Phone"],
['lkup_type'=>6, 'lkup_text'=>"Fax"],
['lkup_type'=>6, 'lkup_text'=>"Home Phone"],
['lkup_type'=>6, 'lkup_text'=>"Cell Phone"]
);
}
}
Any ideas how I can make it NOT use the double quotes? I have tried with double quotes around the table name and column names with same result. The table has a serial column called lkup_id and the default created_at and updated_at columns, do I need to seed those, too?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire