2

I'm using Phinx for databse migrations.

It's not workig with PostgreSQL schemas in my case (example test.table).

// create the table
$table = $this->table('test.table');
$table->addColumn('test', 'integer')
      ->create();

When i hit phinx migrate it causes an arror. Is there any solutions for that?

My error is:

--> IMAGE ERROR

The error is: Syntax error or within "."

Does Phinx supports dot notation in the tablemethod?

Piotr
  • 1,777
  • 17
  • 24

2 Answers2

3

I found alternative solution. Before changes in the table, I manualy selected PostgreSQL schema.

// changing schema
$this->getAdapter()->setOptions(array_replace($this->getAdapter()->getOptions(), ['schema' => 'your_schema']));

// create the table
$table = $this->table('test_table');
$table->addColumn('test', 'integer')
            ->create();
Piotr
  • 1,777
  • 17
  • 24
0

Are you sure you can use dot notation in the table name like that?

// create the table
$table = $this->table('test_table');
$table->addColumn('test', 'integer')
    ->create();

test.table would follow the pattern databasename.tablename

Jeremy Harris
  • 24,318
  • 13
  • 79
  • 133
Carl Casbolt
  • 102
  • 6