0

I have this migrations but

<?php

use Phinx\Migration\AbstractMigration;

class DriverPeakTimes extends AbstractMigration
{

    public function up()
    {   $table = $this->table('peak_times');
        $table->addColumn('from_time', 'time')
              ->addColumn('to_time', 'time')
              ->addColumn('weekday', 'integer')
              ->addColumn('zone_id', 'integer')
              ->save();
        
    }
    public function down()
    {   
        if ($this -> table('peak_times')->exists() -> drop() -> save());

    }
}

Getting an error:

SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'from_time'

When I made this migrations on my development database it worked, there were no problems, but when it came to migrating my production database it is failing to migrate, I do not know the root cause of this problem, because I do not have duplicate columns in my migration moreover I do not have such table and its columns in my database.

Versions of tools I am using to make my migrations:

h3t1
  • 1,126
  • 2
  • 18
  • 29
Alisher
  • 1
  • 1
  • This is because that table and column already exists in your database. Connect via some sql client to that database and check. If there is an identical table, you need to work on your db migration. – Salines Jul 17 '21 at 11:55
  • Probably unrelated, but your down migration looks problematic. – Greg Schmidt Jul 17 '21 at 15:26
  • I have checked many times, but I do not have those tables in my database – Alisher Jul 17 '21 at 15:51

0 Answers0