chore: Upgrade to sqlc version 2 yaml configuration (#5442)

* chore: Upgrade to sqlc version 2 yaml configuration
This commit is contained in:
Steven Masley
2022-12-15 14:40:11 -06:00
committed by GitHub
parent fceac39143
commit 79c71d2d2c

View File

@ -1,22 +1,12 @@
# sqlc is used to generate types from sql schema language.
# It was chosen to ensure type-safety when interacting with
# the database.
version: "1"
packages:
- name: "database"
path: "./queries"
queries: "./queries"
schema: "./dump.sql"
engine: "postgresql"
emit_interface: true
emit_json_tags: true
emit_db_tags: true
# We replace the generated db file with our own
# to add support for transactions. This file is
# deleted after generation.
output_db_file_name: db_tmp.go
version: "2"
# Ideally renames & overrides would go under the sql section, but there is a
# bug in sqlc that only global renames & overrides are currently being applied.
overrides:
go:
overrides:
- column: "provisioner_daemons.tags"
go_type: "github.com/coder/coder/coderd/database/dbtype.StringMap"
- column: "provisioner_jobs.tags"
@ -29,8 +19,7 @@ overrides:
- column: "templates.group_acl"
go_type:
type: "TemplateACL"
rename:
rename:
api_key: APIKey
api_key_scope: APIKeyScope
api_key_scope_all: APIKeyScopeAll
@ -54,3 +43,15 @@ rename:
troubleshooting_url: TroubleshootingURL
default_ttl: DefaultTTL
motd_file: MOTDFile
sql:
- schema: "./dump.sql"
queries: "./queries"
engine: "postgresql"
gen:
go:
package: "database"
out: "./queries"
emit_interface: true
emit_json_tags: true
emit_db_tags: true