Tuesday, 15 January 2013

Laravel Migration and seeding error -



Laravel Migration and seeding error -

i starting utilize laravel framework , command prompt. i'm having problem migration , seeding features, however.

i developing on wamp server on windows 7 64-bit os.

the database name 'laravel', next 2 tables:

migrations users

the users table contains next columns:

id name email username password

i used command line generate migration stored in app\database\migrations\2014_06_24_221654_test.php. created migration , batch fields in migration table.

i want seed email table, used databaseseeder.php in database\seeds folder.

<?php class databaseseeder extends seeder { public function run() { $this->call('usertableseeder'); $this->command->info('user table seeded!'); } } class usertableseeder extends seeder { protected $fillable = array('email'); public function run() { user::create(array('email' => 'jishadp369@gmail.com')); } } ?>

i used next command seed database

php artisan db:seed

however, got next exception:

[illuminate\database\queryexception] sqlstate[42s22]: column not found: 1054 unknown column 'updated_at' in 'field list' (sql: insert `users` (`email`, `updated_at`, `created_at`) values (ji shadp369@gmail.com, 2014-06-25 00:23:48, 2014-06-25 00:23:48))

how can solve this? need model?

thats because user model utilize timestamps fields.

check user model file.

you find $this->timestamps = true in constructor. alter false , seek again. if don't find this, add together attribute class:

public $timestamps = false;

i hope works fine you.

laravel

No comments:

Post a Comment