Doctrine Migrations
  1. Doctrine Migrations
  2. DMIG-31

$table->renameColumn() actually drops the column

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Duplicate
    • Labels:
      None
    • Environment:
      symfony 2.0.7

      Description

      Tried to use renameColumn() into one of my migration scripts and it dropped the table.

      The code does not seem okay as well:

      namespace Doctrine\DBAL\Schema;
      ..
      class Table extends AbstractAsset
      {
      ..
        /**
          * Rename Column
          *
          * @param string $oldColumnName
          * @param string $newColumnName
          * @return Table
          */
      public function renameColumn($oldColumnName, $newColumnName)
      {
          $column = $this->getColumn($oldColumnName);
          $this->dropColumn($oldColumnName);
      
          $column->_setName($newColumnName);
          return $this;
      }
      ..
      

        Activity

        Hide
        Tyler Sommer added a comment -

        Doctrine\DBAL\Schema\Table is actually not a part of Doctrine Migrations, rather just the Database Abstraction Layer project. Recommend this gets sorted as such.

        Show
        Tyler Sommer added a comment - Doctrine\DBAL\Schema\Table is actually not a part of Doctrine Migrations, rather just the Database Abstraction Layer project. Recommend this gets sorted as such.
        Hide
        David Buchmann added a comment -

        this is a duplicate of DMIG-22

        any chances of getting the issue fixed?

        Show
        David Buchmann added a comment - this is a duplicate of DMIG-22 any chances of getting the issue fixed?
        Hide
        Benjamin Eberlei added a comment -

        From the internals this is really complicated. I will delete the method instead.

        Show
        Benjamin Eberlei added a comment - From the internals this is really complicated. I will delete the method instead.
        Hide
        Gonzalo Sainz-Trapaga added a comment -

        Does this mean Doctrine Migrations won't support renaming columns? I'm sorry but the alternative of not supporting it at all doesn't really work. It's a basic operation for DB schema changes, which are the whole point of migrations. What exactly is the proble? I have seen the algorithms for inferring that a column or table should be renamed and they are pretty simplistic. Maybe the solution is adding some sort of hinting to the renameX operations so that there is metadata inside the Table Schemas saying what the original columns or tables were. Thoughts?

        Show
        Gonzalo Sainz-Trapaga added a comment - Does this mean Doctrine Migrations won't support renaming columns? I'm sorry but the alternative of not supporting it at all doesn't really work. It's a basic operation for DB schema changes, which are the whole point of migrations. What exactly is the proble? I have seen the algorithms for inferring that a column or table should be renamed and they are pretty simplistic. Maybe the solution is adding some sort of hinting to the renameX operations so that there is metadata inside the Table Schemas saying what the original columns or tables were. Thoughts?

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Nikola Petkanski
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: