Questions tagged [doctrine-migrations]

Anything related with Doctrine migrations for Symfony and DoctrineMigrationsBundle library

Doctrine migrations for Symfony are maintained in the DoctrineMigrationsBundle.

The database migrations feature is an extension of the database abstraction layer and offers you the ability to programmatically deploy new versions of your database schema in a safe, easy and standardized way.

139 questions
2
votes
0 answers

How to migrate Doctrine in-memory database before PHPUnit tests?

I'm using Doctrine DBAL and want to test (with PHPUnit) my repositories using an in-memory sqlite database. Since it is in-memory I need to run the migrations before the tests. In Laravel you can do this easily by including the RefreshDatabase trait…
2
votes
1 answer

Specify the directory of migrations of each entity manager

i've a multy-database project using symfony 4 and i want to make the migrations of my db1 in a folder called for ex : db1Migrations and the same for db2Migrations. i did some researchs about the subject but all i found is about the symfony2 so i…
Zakymfony
  • 31
  • 6
2
votes
0 answers

Doctrine migrations order

Doctrine generates migrations with the Version{YmdHis} name formatting. Imagine that several teams work on a project. And there are two branches in a VCS: fix_tablename and feature_tablename. feature_tablename has a migration that adds a new field…
2
votes
1 answer

How to use doctrine migrations rollup feature on production server?

I have read: https://symfony.com/doc/master/bundles/DoctrineMigrationsBundle/index.html I'm curious about: doctrine:migrations:rollup. I know what it DOES (deletes my migrations, creates a single one with the whole dump of the current db). But I…
pscheit
  • 2,882
  • 27
  • 29
2
votes
0 answers

Doctrine Migrations: Multiple Schemas With Same Table Name

I am working on integrating Doctrine Migrations into an existing project and in migration files, whenever I call methods on Schema(ex. $schema->getTables()), I get this error: Executing dry run of migration up to 20180726185129 from 0 ++…
vito
  • 21
  • 2
2
votes
1 answer

Rollback doctrine:migrations with Deployer

I have a Symfony 3 application where I use deployer to deploy my application. Also I am using Doctrine Migrations to migrate my database. I use the symfony3 recipe. When I run dep deploy, deployer migrates my database. However, when I run dep…
2
votes
1 answer

DoctrineMigrationsBundle generates same migration every time

I have an entity with field $usedMB. I'm using Doctrine2 as ORM and DoctrineMigrationsBundle for DB migrations. /** * @ORM\Entity */ class DeviceStatus { ... /** * @ORM\Column(type="float", nullable=true, options={"unsigned":true}) …
Matko Đipalo
  • 1,676
  • 1
  • 11
  • 23
2
votes
1 answer

Doctrine Migrations with own database connection instead of using migrations-db.php file

I have been trying to use my own Doctrine\Dbal\Connection object with Doctrine Migrations, this is what I got so far, but it keeps telling me to supply a --db-configuration file, which is not what I want. // CLI script for Doctrine Migrations $app =…
Robbe
  • 192
  • 2
  • 13
2
votes
1 answer

Symfony: migration of user table via browser

I have the following scenario: There's an app that can be installed by clients themselves and as not every webhoster provides console access, clients must be able to install and update the app via browser. (similar to the update process of e.g.…
hchr
  • 317
  • 1
  • 12
2
votes
1 answer

Generate one single migration from all migration files symfony doctrine?

My website is hosted on shared server so I cant run migration command since I dont have access to ssh. Is there any way I can generate one single migration/sql file from all migration files generated during development, so that I can easily…
Sumeet
  • 1,683
  • 20
  • 27
2
votes
1 answer

SQLSTATE[HY000]: General error: 1025 Error on rename error when dropping foreign key in Doctrine Migration

I am seeing the error below when I run the following query inside a Doctrine migration: ALTER TABLE crmpicco_course_version DROP FOREIGN KEY FK_C060B146DE13F470 Migration 20151209153121 failed during Execution. Error An exception occurred while…
crmpicco
  • 16,605
  • 26
  • 134
  • 210
2
votes
0 answers

Entity relations not recognized in traits used by entity class

If I have an entity class that uses a trait which declares entity relations, those entity relations will be ignored by the php app/console doctrine:migrations:diff command. I assume it is the same with the Symfony command php app/console…
mickadoo
  • 3,337
  • 1
  • 25
  • 38
2
votes
0 answers

Doctrine autogenerated migration fails to recognize foreign key constraints

When creating a migration via the command doctrine:migrations:diff I get a migration which cannot be executed afterwards. I have the following scenario: I got 2 entites (parent and child) with a many to many relation between each other. So…
enricog
  • 4,226
  • 5
  • 35
  • 54
2
votes
1 answer

Migration version 20130915081732 already registered with class Doctrine\DBAL\Migrations\Version

I just want to generate a new migration class app/console doctrine:migrations:status [Doctrine\DBAL\Migrations\MigrationException] Migration version 20130915081732 already registered with class Doctrine\DBAL\Migrations\Version My config.yml looks…
ownking
  • 1,956
  • 1
  • 24
  • 34
2
votes
1 answer

Issue in rollback in Doctrine Migrations

Im using Symfony 2.3.1 and I want to deploy my database with DoctrineMigratios but I'm having some troubles on the "up()" function. If I try to execute this example: $this->addSql("CREATE TABLE User (id INT AUTO_INCREMENT NOT NULL, name LONGTEXT…
Omitsis
  • 23
  • 4