Skip to content

Conversation

@kderme
Copy link
Contributor

@kderme kderme commented Nov 30, 2020

I noticed that when the cascade behavior of a field foreign key changes (ie by adding OnDeleteCascade), no migrations is generated. Is there any reason not to? There is a comment An unspecified 'CascadeAction' is defaulted to 'Restrict' when doing migrations., so maybe there is already a way to make migrations work that I missed?

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Bumped the version number if there isn't an (unreleased) on the Changelog
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

@parsonsmatt
Copy link
Collaborator

I fixed CI on master, try merging that in

@kderme
Copy link
Contributor Author

kderme commented Dec 2, 2020

Actually after thinking a bit more, this will trigger many unecessary migrations like

    EXECUTE 'ALTER TABLE "table" DROP CONSTRAINT "table_p_id_fkey"' ;
    EXECUTE 'ALTER TABLE "table" ADD CONSTRAINT "table_p_id_fkey" FOREIGN KEY("p_id") REFERENCES "parent"("id") ON DELETE RESTRICT  ON UPDATE RESTRICT' ;

which is just noise. We can make the equality more lenient, considering Nothing == Just Restrict to avoid it. Opinions?

@kderme kderme force-pushed the fix-reference-migrations branch from 2d02c00 to b0f5918 Compare December 10, 2020 12:35
@kderme kderme force-pushed the fix-reference-migrations branch from b0f5918 to 65d72aa Compare December 10, 2020 12:36
@kderme
Copy link
Contributor Author

kderme commented Dec 10, 2020

I rebased this and extended it with a fix for #1169

@kderme kderme changed the title Fix references Migrations Fix references Migrations for PostgreSQL Dec 10, 2020
@kderme kderme force-pushed the fix-reference-migrations branch from 65d72aa to 1d0c8dd Compare December 10, 2020 13:31
@kderme kderme changed the title Fix references Migrations for PostgreSQL Fix references Migrations Dec 10, 2020
@parsonsmatt
Copy link
Collaborator

We can make the equality more lenient, considering Nothing == Just Restrict to avoid it. Opinions?

Yeah, i"m in favor of that! Nothing just means "unspecified", which does default to Just Restrict, so semantically that's fine.

@kderme
Copy link
Contributor Author

kderme commented Dec 10, 2020

We can make the equality more lenient, considering Nothing == Just Restrict to avoid it. Opinions?

Yeah, i"m in favor of that! Nothing just means "unspecified", which does default to Just Restrict, so semantically that's fine.

Cool this is handled now at equivalentRef

@parsonsmatt
Copy link
Collaborator

Fantastic, thanks! Just needs the CHangelog and a patch version bump :)

Copy link
Collaborator

@parsonsmatt parsonsmatt left a comment

Choose a reason for hiding this comment

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

a few version quibbles, thanks!

@@ -1,5 +1,9 @@
# Changelog for persistent-mysql

## (Unreleased) 2.10.4
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
## (Unreleased) 2.10.4
## 2.10.4.1

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's a bugfix release, no dditions to the api, so a patch version is appropriate :)

Copy link
Contributor Author

@kderme kderme Dec 10, 2020

Choose a reason for hiding this comment

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

should that be 2.10.3.1 then or I'm wrong?

Copy link
Collaborator

Choose a reason for hiding this comment

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

😂 No, you're right - 2.10.3.1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool this should be ready then :)

@@ -1,5 +1,10 @@
# Changelog for persistent-postgresql

## (Unreleased) 2.11.0.1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
## (Unreleased) 2.11.0.1
## 2.11.0.1

I'll get this out asap.

@kderme kderme force-pushed the fix-reference-migrations branch from bfbd0ab to f29b1ef Compare December 10, 2020 18:35
@parsonsmatt parsonsmatt merged commit e98f4b1 into yesodweb:master Dec 10, 2020
@parsonsmatt
Copy link
Collaborator

Released and tagged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants