Doctrine 1
  1. Doctrine 1
  2. DC-508

All but the first migrations fail with PostgreSQL [patch included]

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.2.2
    • Component/s: Migrations
    • Labels:
      None

      Description

      The problem is in this method:

      protected function _createMigrationTable()
      {
          if ($this->_migrationTableCreated) {
              return true;
          }
      
          $this->_migrationTableCreated = true;
      
          try {
              $this->_connection->export->createTable($this->_migrationTableName, array('version' => array('type' => 'integer', 'size' => 11)));
      
              return true;
          } catch(Exception $e) {
              return false;
          }
      }
      

      When migration_version table doesn't exist, everything works like it should. But subsequent migrations fail, because after failing at creating migration_version table every subsequent queries in that transaction fail.

      It works flawlessly with MySQL, but fails with PostgreSQL.

      1. patch-doctrine-migration-pgsql-2.diff
        0.6 kB
        Elnur Abdurrakhimov
      2. patch-migration-pgsql.diff
        1 kB
        Elnur Abdurrakhimov
      3. patch-migrations.diff
        0.9 kB
        Elnur Abdurrakhimov

        Activity

        Hide
        Elnur Abdurrakhimov added a comment -

        My previous patch broke MySQL migrations. This new patch resolves that problem.

        My solution is not neat, but at least migrations work and I can continue developing my project.

        Show
        Elnur Abdurrakhimov added a comment - My previous patch broke MySQL migrations. This new patch resolves that problem. My solution is not neat, but at least migrations work and I can continue developing my project.
        Hide
        Jonathan H. Wage added a comment -

        This isn't really a good patch. I don't wanna have driver specific conditional statements like that.

        What about if we started and committed our own transaction for the create table so that everything else is in another transaction and would not conflict.

        Show
        Jonathan H. Wage added a comment - This isn't really a good patch. I don't wanna have driver specific conditional statements like that. What about if we started and committed our own transaction for the create table so that everything else is in another transaction and would not conflict.
        Hide
        Elnur Abdurrakhimov added a comment -

        This time solution is neater.

        Show
        Elnur Abdurrakhimov added a comment - This time solution is neater.
        Hide
        Elnur Abdurrakhimov added a comment -

        Provided a patch with a neater solution.

        Show
        Elnur Abdurrakhimov added a comment - Provided a patch with a neater solution.
        Hide
        Jonathan H. Wage added a comment -

        Thanks for following up on this and fixing the root cause of the problem.

        Show
        Jonathan H. Wage added a comment - Thanks for following up on this and fixing the root cause of the problem.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Elnur Abdurrakhimov
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: