Skip to content

Commit

Permalink
Merge pull request #54 from obsidiansystems/aa/ltree
Browse files Browse the repository at this point in the history
Add ltree column type
  • Loading branch information
ali-abrar authored Oct 4, 2023
2 parents b1b06fd + 5677d87 commit 5bd03ad
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Revision history for beam-automigrate

## Unreleased

* Add ltree column type

## 0.1.4.0

* [#52](https://github.com/obsidiansystems/beam-automigrate/pull/52) Support sql arrays
Expand Down
2 changes: 2 additions & 0 deletions src/Database/Beam/AutoMigrate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,8 @@ renderDataType = \case
PgSpecificType (PgEnumeration (EnumerationName ty)) -> ty
-- oid
PgSpecificType PgOid -> "oid"
-- ltree
PgSpecificType PgLTree -> "ltree"
-- Arrays
SqlArrayType (SqlArrayType _ _) _ -> error "beam-automigrate: invalid nested array."
SqlArrayType _ 0 -> error "beam-automigrate: array with zero dimensions"
Expand Down
2 changes: 2 additions & 0 deletions src/Database/Beam/AutoMigrate/Postgres.hs
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ pgTypeToColumnType oid width
Just (PgSpecificType PgUuid)
| Pg.typoid Pg.oid == oid =
Just (PgSpecificType PgOid)
| Pg.Oid 16385 == oid =
Just (PgSpecificType PgLTree)
| otherwise =
Nothing

Expand Down
1 change: 1 addition & 0 deletions src/Database/Beam/AutoMigrate/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ data PgDataType
| PgUuid
| PgEnumeration EnumerationName
| PgOid
| PgLTree

deriving instance Show PgDataType

Expand Down

0 comments on commit 5bd03ad

Please sign in to comment.