Skip to content

Commit

Permalink
fix postgres enums (#68)
Browse files Browse the repository at this point in the history
We weren't restricting custom types by things in pg_enum, now we are.
  • Loading branch information
natefinch committed Oct 26, 2017
1 parent 4b0d4dc commit a634174
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions database/drivers/postgres/parse.go
Expand Up @@ -206,6 +206,7 @@ func queryEnums(log *log.Logger, db *sql.DB, schemas []string) (map[string][]*da
SELECT n.nspname, t.typname as type
FROM pg_type t
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace
JOIN pg_enum e ON t.oid = e.enumtypid
WHERE (t.typrelid = 0 OR (SELECT c.relkind = 'c' FROM pg_catalog.pg_class c WHERE c.oid = t.typrelid))
AND NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type el WHERE el.oid = t.typelem AND el.typarray = t.oid)
AND n.nspname IN (%s)`
Expand Down
4 changes: 4 additions & 0 deletions site/content/templates/data.md
Expand Up @@ -92,12 +92,16 @@ have the following properties:
| Property | Type | Description |
| --- | ---- | --- |
| ConnStr | string | the connection string for the database
| DBType | string | the type of db
| Schemas | list of string | the schema names to generate files for
| IncludeTables | map[string] list of string | whitelist map of schema names to table names in that schema to generate files for.
| ExcludeTables | map[string] list of string | blacklist map of schema names to table names in that schema to not generate files for.
| PostRun | list of string | the command to run on files after generation
| TypeMap | map[string]string | map of DBNames to converted names for column types
| NullableTypeMap | map[string]string | map of DBNames to converted names for column types (used when Nullable=true)
| PluginDirs | list of string | ordered list of directories to look in for plugins
| OutputDir | string | the directory where gnorm should output all its data
| StaticDir | string | the directory from which to statically copy files to outputdir

### Enum

Expand Down

0 comments on commit a634174

Please sign in to comment.