go-gorm / postgres

GORM PostgreSQL driver
MIT License
225 stars 119 forks source link

Add missing postgres type aliases #270

Closed lasse-it closed 2 months ago

lasse-it commented 4 months ago

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:

lasse-it commented 3 months ago

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