I would like to add a database table to an existing bundle.
But currently i can't find a way to integrate it into the DoctrineMigration process without a fixed coupling.
I have installed "doctrine/doctrine-migrations-bundle": "^2.2" but then I get the error message: Maximum one migration path can be specified with the 2.x version.
Currently I have solved it with a command which uses Doctine to create and update the table.
//Example
$schema = new Schema();
$entryTable = $schema->createTable($this->getTableName());
$entryTable->addColumn(
'id',
'integer',
[
'unsigned' => true,
'autoincrement' => true
]
);
$entryTable->addColumn(
'col1',
'string',
[
'length' => 255,
'notNull' => true
]
);
$entryTable->addColumn(
'col2',
'string',
[
'length' => 255,
'notNull' => true
]
);
$entryTable->setPrimaryKey(array('id'));
$queries = $schema->toSql($this->databaseConnection->getDatabasePlatform());
$this->databaseConnection->query($queries);
Is there a smarter way?
Best regards,
André