go-gorm / postgres

GORM PostgreSQL driver
MIT License
225 stars 119 forks source link

Add "boolean" as an alias for "bool" #256

Closed imax9000 closed 5 months ago

imax9000 commented 6 months ago

Postgres returns udt_type "bool" for columns of type "boolean"

User Case Description

Otherwise migrator detects a type mismatch and attempts to needlessly change the column type. This is normally not an issue. However, it fails when there's a view that depends on that column:

ALTER TABLE "records" ALTER COLUMN "deleted" TYPE boolean USING "deleted"::boolean: ERROR: cannot alter type of a column used by a view or rule (SQLSTATE 0A000)

This in turn fails the whole auto-migration.