Skip to content

Table is not being created and yet shows "All Done" in the console #496

Description

@kabirbaidhya

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions