Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explicit renameColumn method #6280

Merged
merged 4 commits into from
Aug 2, 2024
Merged

Add explicit renameColumn method #6280

merged 4 commits into from
Aug 2, 2024

Conversation

Tofandel
Copy link
Contributor

Merges the changes of #6080 into 4.0.x

return '';
}

if (! empty($column['version'])) {
if ((string) $column['type'] !== 'DateTime') {
Copy link
Contributor Author

@Tofandel Tofandel Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be covered by tests, when I messed around and removed the if there was an error that Dbal/Types/DateTimeType cannot be converted to string, which makes sense because 'type' in column is a DbalType which doesn't have a __toString(), might need to be backported to 3.8 as well

I also think in 4.x we should abolish column converted to arrays in all the AbstractPlatform methods and use the Column class to get the correct type hints and static analysis (for a different PR)

@derrabus derrabus changed the title Merge branch '3.8.x' into 4.0.x Add explicit renameColumn method (4.x) Jan 26, 2024
@derrabus
Copy link
Member

Since we've reverted the feature, this is technically not a merge anymore. I've adjusted the PR title accordingly. Can you please rebase your changes onto 4.0.x? Currently the PR contains irrelevant changes that 4.0.x contains already.

@derrabus derrabus added this to the 4.1.0 milestone Feb 3, 2024
@derrabus derrabus changed the base branch from 4.0.x to 4.1.x February 3, 2024 18:37
greg0ire
greg0ire previously approved these changes Feb 6, 2024
src/Schema/TableDiff.php Outdated Show resolved Hide resolved
@Tofandel
Copy link
Contributor Author

Tofandel commented Feb 21, 2024

Hmmm, 4.0.x was released already? I though you would wait for this PR on both 3.9 and 4.0

Then this PR which includes breaking changes which were meant to be deprecated in 3.x cannot be released anymore in 4.x from my understanding and only in 5.x and the PR #6080 without the breaking changes need to be redone for 4.x?

This is way more work than I can put into this ATM

@greg0ire
Copy link
Member

Hmmm, 4.0.x was released already? I though you would wait for this PR on both 3.9 and 4.0

Sorry we didn't warn you about it, we had a lot on our plate and this apparently fell through the cracks.

Then this PR which includes breaking changes which were meant to be deprecated in 3.x cannot be released anymore in 4.x from my understanding and only in 5.x and the PR #6080 without the breaking changes need to be redone for 4.x?

Yes, exactly. There is very little difference between 5.0.x and 4.1.x right now, so the most convenient time to do it is now. I think what you can do is:

  • retarget this to 5.0.x, which shouldn't be very hard because of how little conflicts there should be
  • open another PR that is a revert of @derrabus 's revert. I don't expect that to be a lot of work either.

@Tofandel
Copy link
Contributor Author

Tofandel commented Feb 21, 2024

Should the revert be for 3.9 or 4.1 ?

If it's for 4.x we still have the same problem with tons of conflict with v4 so it's easier to start from this PR and simply revert the breaking changes using the old PR

I could open 3 PRs, one against 3.9 again without breaking change which is basically the old reverted PR, 4.1 which is this port still but without breaking changes and 5.0.x which is this PR

@derrabus
Copy link
Member

Sorry, I'm kinda busy right now, but I haven forgotten this PR. Promise!

  • 4.1.x is the target for this PR.
  • I can revert my revert on 3.9 myself when I merge this one. Don't worry.
  • Breaking changes will need to go into 5.x.

Copy link

There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.
If you want to continue working on it, please leave a comment.

@github-actions github-actions bot added the Stale label May 22, 2024
@derrabus
Copy link
Member

And that's my fault, dear bot. Let's keep it open.

@derrabus derrabus removed the Stale label May 22, 2024
@derrabus derrabus changed the title Add explicit renameColumn method (4.x) Add explicit renameColumn method Aug 2, 2024
@derrabus derrabus merged commit 0f0398a into doctrine:4.1.x Aug 2, 2024
75 checks passed
@derrabus
Copy link
Member

derrabus commented Aug 2, 2024

Let's ship this. Apologies for this really way too long delay.

I decided that we will ship this feature with 4.1.0 only, without a backport to 3.x. Because we're very low on maintainers on this repository, I'd like to keep DBAL 3 super-stable which means we're not shipping new features on that branch. I hope this is okay for you.

derrabus added a commit to derrabus/dbal that referenced this pull request Aug 2, 2024
* 4.1.x:
  Add explicit renameColumn method (doctrine#6280)
  Make AbstractSchemaManager covariant to its template argument
@Tofandel
Copy link
Contributor Author

Tofandel commented Aug 2, 2024

No problem with me, I'm also very busy and didn't have time to review this to make a PR for v4 and v5, though I do believe there were a few minor breaking changes in this PR (I think only in TableDiff, 2 methods removed) which might need a compatibility layer for v4 which is what I didn't have time to check but I already made it in the previous PR for v3 so it might just be a question of taking those 2 methods from the old PR and remove them in v5

@Tofandel
Copy link
Contributor Author

Tofandel commented Aug 2, 2024

Here I took the code from the old PR and adapted it for v4

    /**
     * @deprecated Use {@see getChangedColumns()} instead.
     *
     * @return list<ColumnDiff>
     */
    public function getModifiedColumns(): array
    {
        Deprecation::triggerIfCalledFromOutside(
            'doctrine/dbal',
            'https://github.com/doctrine/dbal/pull/6280',
            '%s is deprecated, use `getChangedColumns()` instead.',
            __METHOD__,
        );

        return array_values(array_filter($this->getChangedColumns(), static function (ColumnDiff $diff) {
            return $diff->countChangedProperties() > ($diff->hasNameChanged() ? 1 : 0);
        }));
    }
    
    
    /**
     * @deprecated Use {@see getChangedColumns()} instead.
     *
     * @return array<string,Column>
     */
    public function getRenamedColumns(): array
    {
        Deprecation::triggerIfCalledFromOutside(
            'doctrine/dbal',
            'https://github.com/doctrine/dbal/pull/6280',
            '%s is deprecated, you should use `getChangedColumns()` instead.',
            __METHOD__,
        );
        $renamed = [];
        foreach ($this->getChangedColumns() as $diff) {
            if (! $diff->hasNameChanged()) {
                continue;
            }

            $oldColumnName           = $diff->getOldColumn()->getName();
            $renamed[$oldColumnName] = $diff->getNewColumn();
        }

        return $renamed;
    }

derrabus added a commit to derrabus/dbal that referenced this pull request Aug 2, 2024
* 4.1.x:
  Fix tests (doctrine#6481)
  Add explicit renameColumn method (doctrine#6280)
  Make AbstractSchemaManager covariant to its template argument
@derrabus
Copy link
Member

derrabus commented Aug 2, 2024

Right, we're missing the deprecation layer now. Let me check if I can add it.

@derrabus
Copy link
Member

derrabus commented Aug 2, 2024

See #6482

sbuerk added a commit to sbuerk/dbal that referenced this pull request Aug 13, 2024
With doctrine#6280 quite some changes has been applied,
which removed the code path to create alter sql
statement if length of a field has changed.

This change adds a general test for this case
and reimplement the accidently removed code
from the `PostgreSQLPlatform`.
sbuerk added a commit to sbuerk/dbal that referenced this pull request Aug 13, 2024
With doctrine#6280 quite some changes has been applied,
which removed the code path to create alter sql
statement if length of a field has changed.

This change adds a general test for this case
and reimplement the accidently removed code
from the `PostgreSQLPlatform`.
sbuerk added a commit to sbuerk/dbal that referenced this pull request Aug 13, 2024
With doctrine#6280 quite some changes has been applied,
which removed the code path to create alter sql
statement if length of a field has changed.

This change adds a general test for this case
and reimplement the accidently removed code
from the `PostgreSQLPlatform`.
sbuerk added a commit to sbuerk/dbal that referenced this pull request Aug 13, 2024
With doctrine#6280 quite some changes has been applied,
which removed the code path to create alter sql
statement if length of a field has changed.

This change adds a general test for this case
and reimplement the accidently removed code
from the `PostgreSQLPlatform`.
sbuerk added a commit to sbuerk/dbal that referenced this pull request Aug 13, 2024
With doctrine#6280 quite some changes has been applied,
which removed the code path to create alter sql
statement if length of a field has changed.

This change adds a general test for this case
and reimplement the accidently removed code
from the `PostgreSQLPlatform`.
sbuerk added a commit to sbuerk/dbal that referenced this pull request Aug 13, 2024
With doctrine#6280 quite some changes has been applied,
which removed the code path to create alter sql
statement if length of a field has changed.

This change adds a general test for this case
and reimplement the accidently removed code
from the `PostgreSQLPlatform`.
derrabus added a commit that referenced this pull request Aug 14, 2024
|      Q       |   A
|------------- | -----------
| Type         | feature
| Fixed issues | N/A

#### Summary

#6280 removed columns without explicitly deprecating them. This PR adds
the missing deprecation layer.

Co-authored-by: Tofandel <[email protected]>
reviewtypo3org pushed a commit to TYPO3/typo3 that referenced this pull request Aug 15, 2024
The Doctrine Team recently released minor version
release `4.1.0` including a couple of bugfixes,
internal changes and also new features [1].

The aforementioned internal changes introduces
breaking stuff within internal implementation,
for example the TYPO3 Database Analyzer stack
enforcing adoption [2][3][4]. Sadly, it's not
possible to provide backwards compatible code
and thus minimum version raise is "absolutly"
required.

Doctrine DBAL 4.1.0 also includes new platform
implementation for some database platforms and
this change adds them as extend replacements
to ensure working state with TYPO3 DB Analyzer.

Note that previous TYPO3 v13.x composer instances
needs to limit doctrine/dbal to 4.0.x on their own
to avoid breaking behaviour.

Used command(s):

\
  composer require --no-update --no-install \
    -d typo3/sysext/redirects \
    "doctrine/dbal":"^4.1" \
  && composer require --no-update --no-install \
    -d typo3/sysext/core \
    "doctrine/dbal":"^4.1" \
  && composer require --no-update --no-install \
    -d typo3/sysext/install \
    "doctrine/dbal":"^4.1" \
  && composer require "doctrine/dbal":"^4.1"

[1] https://github.com/doctrine/dbal/releases/tag/4.1.0
[2] doctrine/dbal#6280
[3] doctrine/dbal#6482
[4] doctrine/dbal#6490

Resolves: #104628
Releases: main
Change-Id: I53c86feed17abc6a90625e27fb135f606a57fc9f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85620
Reviewed-by: Christian Kuhn <[email protected]>
Reviewed-by: Andreas Kienast <[email protected]>
Tested-by: core-ci <[email protected]>
Tested-by: Christian Kuhn <[email protected]>
Tested-by: Andreas Kienast <[email protected]>
Tested-by: Stefan Bürk <[email protected]>
Reviewed-by: Stefan Bürk <[email protected]>
TYPO3IncTeam pushed a commit to TYPO3-CMS/core that referenced this pull request Aug 15, 2024
The Doctrine Team recently released minor version
release `4.1.0` including a couple of bugfixes,
internal changes and also new features [1].

The aforementioned internal changes introduces
breaking stuff within internal implementation,
for example the TYPO3 Database Analyzer stack
enforcing adoption [2][3][4]. Sadly, it's not
possible to provide backwards compatible code
and thus minimum version raise is "absolutly"
required.

Doctrine DBAL 4.1.0 also includes new platform
implementation for some database platforms and
this change adds them as extend replacements
to ensure working state with TYPO3 DB Analyzer.

Note that previous TYPO3 v13.x composer instances
needs to limit doctrine/dbal to 4.0.x on their own
to avoid breaking behaviour.

Used command(s):

\
  composer require --no-update --no-install \
    -d typo3/sysext/redirects \
    "doctrine/dbal":"^4.1" \
  && composer require --no-update --no-install \
    -d typo3/sysext/core \
    "doctrine/dbal":"^4.1" \
  && composer require --no-update --no-install \
    -d typo3/sysext/install \
    "doctrine/dbal":"^4.1" \
  && composer require "doctrine/dbal":"^4.1"

[1] https://github.com/doctrine/dbal/releases/tag/4.1.0
[2] doctrine/dbal#6280
[3] doctrine/dbal#6482
[4] doctrine/dbal#6490

Resolves: #104628
Releases: main
Change-Id: I53c86feed17abc6a90625e27fb135f606a57fc9f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85620
Reviewed-by: Christian Kuhn <[email protected]>
Reviewed-by: Andreas Kienast <[email protected]>
Tested-by: core-ci <[email protected]>
Tested-by: Christian Kuhn <[email protected]>
Tested-by: Andreas Kienast <[email protected]>
Tested-by: Stefan Bürk <[email protected]>
Reviewed-by: Stefan Bürk <[email protected]>
TYPO3IncTeam pushed a commit to TYPO3-CMS/install that referenced this pull request Aug 15, 2024
The Doctrine Team recently released minor version
release `4.1.0` including a couple of bugfixes,
internal changes and also new features [1].

The aforementioned internal changes introduces
breaking stuff within internal implementation,
for example the TYPO3 Database Analyzer stack
enforcing adoption [2][3][4]. Sadly, it's not
possible to provide backwards compatible code
and thus minimum version raise is "absolutly"
required.

Doctrine DBAL 4.1.0 also includes new platform
implementation for some database platforms and
this change adds them as extend replacements
to ensure working state with TYPO3 DB Analyzer.

Note that previous TYPO3 v13.x composer instances
needs to limit doctrine/dbal to 4.0.x on their own
to avoid breaking behaviour.

Used command(s):

\
  composer require --no-update --no-install \
    -d typo3/sysext/redirects \
    "doctrine/dbal":"^4.1" \
  && composer require --no-update --no-install \
    -d typo3/sysext/core \
    "doctrine/dbal":"^4.1" \
  && composer require --no-update --no-install \
    -d typo3/sysext/install \
    "doctrine/dbal":"^4.1" \
  && composer require "doctrine/dbal":"^4.1"

[1] https://github.com/doctrine/dbal/releases/tag/4.1.0
[2] doctrine/dbal#6280
[3] doctrine/dbal#6482
[4] doctrine/dbal#6490

Resolves: #104628
Releases: main
Change-Id: I53c86feed17abc6a90625e27fb135f606a57fc9f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85620
Reviewed-by: Christian Kuhn <[email protected]>
Reviewed-by: Andreas Kienast <[email protected]>
Tested-by: core-ci <[email protected]>
Tested-by: Christian Kuhn <[email protected]>
Tested-by: Andreas Kienast <[email protected]>
Tested-by: Stefan Bürk <[email protected]>
Reviewed-by: Stefan Bürk <[email protected]>
TYPO3IncTeam pushed a commit to TYPO3-CMS/redirects that referenced this pull request Aug 15, 2024
The Doctrine Team recently released minor version
release `4.1.0` including a couple of bugfixes,
internal changes and also new features [1].

The aforementioned internal changes introduces
breaking stuff within internal implementation,
for example the TYPO3 Database Analyzer stack
enforcing adoption [2][3][4]. Sadly, it's not
possible to provide backwards compatible code
and thus minimum version raise is "absolutly"
required.

Doctrine DBAL 4.1.0 also includes new platform
implementation for some database platforms and
this change adds them as extend replacements
to ensure working state with TYPO3 DB Analyzer.

Note that previous TYPO3 v13.x composer instances
needs to limit doctrine/dbal to 4.0.x on their own
to avoid breaking behaviour.

Used command(s):

\
  composer require --no-update --no-install \
    -d typo3/sysext/redirects \
    "doctrine/dbal":"^4.1" \
  && composer require --no-update --no-install \
    -d typo3/sysext/core \
    "doctrine/dbal":"^4.1" \
  && composer require --no-update --no-install \
    -d typo3/sysext/install \
    "doctrine/dbal":"^4.1" \
  && composer require "doctrine/dbal":"^4.1"

[1] https://github.com/doctrine/dbal/releases/tag/4.1.0
[2] doctrine/dbal#6280
[3] doctrine/dbal#6482
[4] doctrine/dbal#6490

Resolves: #104628
Releases: main
Change-Id: I53c86feed17abc6a90625e27fb135f606a57fc9f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85620
Reviewed-by: Christian Kuhn <[email protected]>
Reviewed-by: Andreas Kienast <[email protected]>
Tested-by: core-ci <[email protected]>
Tested-by: Christian Kuhn <[email protected]>
Tested-by: Andreas Kienast <[email protected]>
Tested-by: Stefan Bürk <[email protected]>
Reviewed-by: Stefan Bürk <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants