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

Fix incorrect behavior when adding an autoincrement column to a Postg… #697

Merged
merged 2 commits into from
Sep 8, 2023
Merged

Fix incorrect behavior when adding an autoincrement column to a Postg… #697

merged 2 commits into from
Sep 8, 2023

Conversation

lilyrrose
Copy link
Contributor

PR Info

Bug Fixes

Using the PostgresQueryBuilder I would've expected this:

Table::alter()
	.table(Test::Table)
	.add_column(
		ColumnDef::new(Test::Id)
			.integer()
			.auto_increment()
			.primary_key(),
	)

to give me: (This behavior is true if you use Table::create)
ALTER TABLE "test" ADD COLUMN "id" serial PRIMARY KEY

Instead it gave me:
ALTER TABLE "test" ADD COLUMN "id" integer PRIMARY KEY

Breaking Changes

If someone was using auto_increment() on anything but an integer, smallinteger, or biginteger it would cause a panic.

Changes

Modified the postgres alter_10 test to test against the correct behavior.

@lilyrrose
Copy link
Contributor Author

of course I had to forget rustfmt, sorry ^^

Copy link
Member

@tyt2y3 tyt2y3 left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution

@tyt2y3 tyt2y3 merged commit 375b7dc into SeaQL:master Sep 8, 2023
20 checks passed
tyt2y3 pushed a commit that referenced this pull request Sep 8, 2023
#697)

* Fix incorrect behavior when adding an autoincrement column to a Postgres table.

* rustfmt
@github-actions
Copy link

🎉 Released In 0.30.2 🎉

Thank you everyone for the contribution!
This feature is now available in the latest release. Now is a good time to upgrade!
Your participation is what makes us unique; your adoption is what drives us forward.
You can support SeaQL 🌊 by starring our repos, sharing our libraries and becoming a sponsor ⭐.

1 similar comment
@github-actions
Copy link

🎉 Released In 0.30.2 🎉

Thank you everyone for the contribution!
This feature is now available in the latest release. Now is a good time to upgrade!
Your participation is what makes us unique; your adoption is what drives us forward.
You can support SeaQL 🌊 by starring our repos, sharing our libraries and becoming a sponsor ⭐.

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.

None yet

2 participants