Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Commit

Permalink
fix: Migrator: Use correct underlying type for ARRAY columns in down …
Browse files Browse the repository at this point in the history
…migrations (#236)

Co-authored-by: Kemal Hadimli <[email protected]>
  • Loading branch information
disq and disq authored May 2, 2022
1 parent 66f762e commit a31a92e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion migration/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

const (
queryTableColumns = `SELECT ARRAY_AGG(column_name::text) AS columns, ARRAY_AGG(data_type::text) AS types FROM information_schema.columns WHERE table_schema=$1 AND table_name=$2`
queryTableColumns = `SELECT ARRAY_AGG(column_name::text) AS columns, ARRAY_AGG(udt_name::regtype::text) AS types FROM information_schema.columns WHERE table_schema=$1 AND table_name=$2`
addColumnToTable = `ALTER TABLE IF EXISTS %s ADD COLUMN IF NOT EXISTS %v %v;`
dropColumnFromTable = `ALTER TABLE IF EXISTS %s DROP COLUMN IF EXISTS %v;`
renameColumnInTable = `-- ALTER TABLE %s RENAME COLUMN %v TO %v; -- uncomment to activate, remove ADD/DROP COLUMN above and below` // Can't have IF EXISTS here
Expand Down

0 comments on commit a31a92e

Please sign in to comment.