Skip to content

Add missing postgres type aliases #270

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

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

lasse-it
Copy link

@lasse-it lasse-it commented Apr 4, 2024

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

A bunch of Postgres-type aliases are missing in the migrator. AutoMigrate performs an ALTER COLUMN even though the column already has the specified data type.

This PR adds the missing aliases, ensuring that the migrator doesn't execute the ALTER COLUMN statement, when the given column is already migrated.

The complete list of aliases is in Table 8.1 in the Postgres documentation here.

User Case Description

Adding these aliases ensures that ALTER COLUMN isn't performed when invoking AutoMigrate on a table, where the columns used one of the following types:

  • integer
  • smallserial
  • serial
  • bigserial
  • bit varying
  • character
  • character varying
  • real
  • double precision
  • time with time zone

Copy link
Member

@a631807682 a631807682 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, can you add some tests in https://github.com/go-gorm/gorm ?

@lasse-it
Copy link
Author

@a631807682 do you have an example of a similar test I can draw inspiration from?

@jinzhu jinzhu merged commit 27eff96 into go-gorm:master Jun 12, 2024
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.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy