1

I want to migrate my database to another database server in laravel, I use this generator https://github.com/Xethron/migrations-generator to generate my migration file

But after i run command

php artisan migrate

It's showing error:

[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Table 'm_bank' already has a primary key def ined on it. (SQL: alter table "m_bank" add constraint "PK__m_bank__C5B92243C150E9EA" primary key ("bank_code"))

my migration file:

Schema::create('m_bank_channel', function(Blueprint $table)
        {
            $table->integer('bank_channel_id', true);
            $table->char('bank_channel_code', 10)->primary('PK__m_bank_c__D2103413480C791A');
            $table->char('bank_code', 10);
            $table->char('channel_code', 4);
            $table->string('description', 250);
            $table->string('created_by', 15);
            $table->dateTime('created_date');
            $table->string('modified_by', 15);
            $table->dateTime('modified_date');
            $table->char('is_active', 1);
        });

The 'bank_channel_id' should be primary key and the 'bank_channel_code' is foreign key, is it bug of generator to create foreign key?

Or any idea to solve this?

Ferry Sanjaya
  • 224
  • 2
  • 17
  • 1
    Look carefully at your error. It is referring to the `m_bank` table, not the `m_bank_channel` table. I suggest looking at your other migrations. – Jason Oct 26 '19 at 07:48
  • @Jason i know right , that is the result from the generator, after i run php artisan migrate:generate. i dont know is it the generator bug or what – Ferry Sanjaya Oct 26 '19 at 09:48

0 Answers0