Project

General

Profile

Actions

Bug #93491

closed

Removed columns are not recognized when analyzing the database using PostgreSQL (and not renamed to zzz_deleted_)

Added by Stephan Großberndt almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If a column of a table has been removed in a ext_tables.sql definition the according change to rename it adding the prefix zzz_deleted_ is not done on PostgreSQL.

How to reproduce:

1. Have TYPO3 installation running on a PostgreSQL database
2. Remove a column from an ext_tables.sql definition, e.g. be_users.avatar in sysext/core/ext_tables.sql
3. Go to "Maintenance" and click on "Analyze database"
4. There is no statement for renaming be_users.avatar to be_users.zzz_deleted_avatar

This may lead to major issues if columns are removed which require a certain datatype that is not set as default, leading to making it impossible to add rows to the table.


Related issues 2 (1 open1 closed)

Related to TYPO3 Core - Epic #90719: PostgreSQL related issuesAccepted2020-03-10

Actions
Related to TYPO3 Core - Bug #93568: Revert database-related changes in Schema Diff / MigratorClosedBenni Mack2021-02-23

Actions
Actions #1

Updated by Stephan Großberndt almost 4 years ago

  • Related to Epic #90719: PostgreSQL related issues added
Actions #2

Updated by Stephan Großberndt almost 4 years ago

  • Start date deleted (2021-02-11)

The corresponding test has been intentionally disabled (which makes matters worse I think):

   /**
     * @test
     * @group not-postgres
     * @group not-mssql
     * @group not-sqlite
     */
    public function renameUnusedField()
    {
        $statements = $this->readFixtureFile('unusedColumn');
        $updateSuggestions = $this->subject->getUpdateSuggestions($statements, true);

        $this->subject->migrate(
            $statements,
            $updateSuggestions[ConnectionPool::DEFAULT_CONNECTION_NAME]['change']
        );

        self::assertFalse($this->getTableDetails()->hasColumn('hidden'));
        self::assertTrue($this->getTableDetails()->hasColumn('zzz_deleted_hidden'));
    }

https://github.com/TYPO3/TYPO3.CMS/blob/v11.0.0/typo3/sysext/core/Tests/Functional/Database/Schema/SchemaMigratorTest.php#L206

Actions #3

Updated by Gerrit Code Review almost 4 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67752

Actions #4

Updated by Gerrit Code Review almost 4 years ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67772

Actions #5

Updated by Gerrit Code Review almost 4 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67772

Actions #6

Updated by Gerrit Code Review over 3 years ago

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/68013

Actions #7

Updated by Stephan Großberndt over 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #8

Updated by Benni Mack over 3 years ago

  • Related to Bug #93568: Revert database-related changes in Schema Diff / Migrator added
Actions #9

Updated by Oliver Hader over 3 years ago

  • Status changed from Resolved to New
Actions #10

Updated by Oliver Hader over 3 years ago

Reopened since tests failed

./Build/Scripts/runTests.sh -p 7.4 -d mssql -s functional -e "--filter renameUnusedField" \
 typo3/sysext/core/Tests/Functional/Database/Schema/SchemaMigratorTest.php

Reverted

Actions #11

Updated by Gerrit Code Review over 3 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/68056

Actions #12

Updated by Gerrit Code Review over 3 years ago

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/68114

Actions #13

Updated by Stephan Großberndt over 3 years ago

  • Status changed from Under Review to Resolved
Actions #14

Updated by Benni Mack over 3 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF