Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8380789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:32:46+00:00 2026-06-09T16:32:46+00:00

Running php app/console doctrine:migrations:diff generates a new migration class as required to translate the

  • 0

Running php app/console doctrine:migrations:diff generates a new migration class as required to translate the current database schema to that specified by changes to entities.

This example shows such a generated class for creating a fos_user table:

class Version20120712145445 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");        
        $this->addSql("CREATE TABLE fos_user (id INT AUTO_INCREMENT NOT NULL, ...);
    }

    public function down(Schema $schema)
    {
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");        
        $this->addSql("DROP TABLE fos_user");
    }
}

As you can see, this the generated migration is tied to a specific database server, that being MySQL in this instance.

I’d like to use an in-memory sqlite database in test environments due to the (expected) performance benefits reducing test execution time.

I could take the above generated SQL and translate that into $table = $schema->createTable(); $table->addColumn(); equivalents, however doing so is both time consuming and invites the introduction of errors due to a poor human translation of SQL to code.

Can the doctrine:migrations:diff command create platform-agnostic migration code instead of the above platform-specific SQL?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:32:48+00:00Added an answer on June 9, 2026 at 4:32 pm

    No, that is not possible with the current versions. If you need database agnostic migrations you should take a look at LiquiBase for migrations. There is a Symfony2 Bundle for LiquiBase too LiquibaseBundle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im working with Symfony2. Im trying to execute the following command: php app/console doctrine:database:create
We are running a PHP (zend framework) app that creates a database per user
Since I moved a PHP app to a new server (PHP/5.3.8 running as Apache
Objective We're developing a PHP console app that will be a running as a
I have a PHP app running happily on the following system: web app: PHP
i am setting up cakephp app on a windows server running iis7. PHP is
Running PHP debug session in Netbeans always opens as a new tab in browser
I have a standard php app that uses SQL Server as the back-end database.
What are the downsides to running a forked PHP app on the web? I
I've been working on an Android app where server side is running PHP. Currently

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.