Migrations: execute only delta changes, not whole schema each time

Each migration class for table means that it should include all previous schema. But I want only add one column 'new_field', for example. I dont want use morthTable method for searching the changes, I want just execute already prepared changes in new v1.0.N+1 migration.

for example:

    public function up()
    {
        $this->addColumn(
            'test_table',
              new Column(
                'new_field',
                array(
                'type' => Column::TYPE_INTEGER,
                'notNull' => true,
                'autoIncrement' => true,
                'size' => 11,
                'first' => true
              )
            )


1.5k
edited Feb '15

well that would mean when running the migration to generate it, it would have already searched for previous version, and take note of the changes. unfortunately unless the whole migrations table is rewritten, i see no workaround for this.

  • first the columns would have to become a public variable to allow future versions to read them thus knowing what to change.
  • next is adding the checks when generating

Also one thing about that sort of migrations is, you HAVE to keep all 200 previous versions if you have that many.

got it, thanks