I'm trying to migrate two tables. Here's the code for them.
class CreateAdminFakeUserTable extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up()
{
$table = $this->table('admin_fake_user');
$table->addColumn('user_id', 'integer')
->addForeignKey('user_id', 'user', 'id', array('delete' => 'CASCADE'))
->save();
}
...
}
class CreatePostsTable extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up()
{
$posts = $this->table('posts');
$posts->addColumn('title', 'string', array('limit' => 40))
->addColumn('body', 'text')
->addColumn('created', 'datetime')
->save();
}
...
}
When I run $ php phinx migrate. It says both the tables have been migrated and ends successfully. But in the database I find only the posts table gets created and not the first table. Even the phinxlog table shows 2 rows; which I guess should be 1 for each table. But the first table admin_fake_user isn't being created.
I've tried rolling back and migrating again but it didn't work.
I have the same problem, when I'm trying to create table with some errors (e.g. two same column names). Phinx don't create that table and skip it silently (it seems like it is okay, but table isn't created).
I tried wrap my migration to try catch block, but it catch nothing. Currently using Phinx in version 0.4.3.
Any update on this one?
Trying to replicate and was unable. The migration from the OP passes successfully in mysql and sqlite and doing a migration with an error (like having two columns with same names) throws a noisy error and the migrate is marked as failed.
@dereuromark this can probably be closed given the age and extensive changes made in the meantime and a new issue can be made if this is still a problem.
@MasterOdin @dereuromark It's been a long time, I ran into this issue while testing it out and later I didn't have to use this as our use-case was different then.
I'm not sure if the issue still persists or makes sense as of now.
I'll leave it to you guys if you want to close this or proceed for a fix. Thanks!