php - Databse migration throws error while seeding two timestamp columns laravel 5 -
i extended default migration include additional table fields user table.
i wanted have created_at , updated_at fields timestamps values.
here code
<?php use illuminate\database\schema\blueprint; use illuminate\database\migrations\migration; class createuserstable extends migration { /** * run migrations. * * @return void */ public function up() { schema::create('users', function(blueprint $table) { $table->bigincrements('id'); $table->biginteger('group_id'); $table->string('fname',255); $table->string('lname',255); $table->string('email',255)->unique(); $table->string('password', 60); $table->boolean('active'); $table->string('gravtar',255)->nullable(); $table->remembertoken(); $table->timestamps('created_at'); $table->timestamps('updated_at'); }); } /** * reverse migrations. * * @return void */ public function down() { schema::drop('users'); } } the obstacle using 2 timestamps columns not migrate tables , throws exception
[pdoexception] sqlstate[42s21]: column exists: 1060 duplicate column name 'created_at' see, have 1 column name created_at , exception make no sense. when drop 1 of timestamps field, table migrated.
i have no clue causing this?
timestamps() method adds both created_at , updated_at columns. method doesn't accept arguments.
http://laravel.com/api/5.0/illuminate/database/schema/blueprint.html#method_timestamps http://laravel.com/docs/5.0/schema
Comments
Post a Comment