Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Oil
oil migrate problem Error - SQLSTATE[42S21]: Column already exists:
2_legit_2_quit
November 2012
I added a field to my table using this oil command:
php oil generate migration add_bio_to_accounts bio:text
. now i want to add another field to the same table and I keep getting the following error:
Error - SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name ...
I dont understand why it keeps going back to the previous migration and not the new one?
Harro
November 2012
Have a look at the migration file generated, what does it contain?
2_legit_2_quit
November 2012
Thanks for getting back to me. Below is whats in the last migration that ran successfully and the one that is producing the error.
namespace Fuel\Migrations;
class Add_slug_to_posts
{
public function up()
{
\DBUtil::add_fields('posts', array(
'slug' => array('constraint' => 255, 'type' => 'varchar'),
));
}
public function down()
{
\DBUtil::drop_fields('posts', array(
'slug'
));
}
}
amespace Fuel\Migrations;
class Add_summary_to_posts
{
public function up()
{
\DBUtil::add_fields('posts', array(
'slug' => array('type' => 'text'),
));
}
public function down()
{
\DBUtil::drop_fields('posts', array(
'slug'
));
}
}
Harro
November 2012
These two migration files add the same column ('slug'), so it's logical you get this database error?
Both don't match the oil command you gave earlier btw...
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
2_legit_2_quit
November 2012
Harro
November 2012