From 0e896d9e8f7c67314a67d3fd722f60f417c58414 Mon Sep 17 00:00:00 2001 From: Yvan da Silva Date: Fri, 30 Aug 2024 22:54:50 +0200 Subject: [PATCH 1/2] sqlc: remove wrong unique schema.sql.rules check The check was not testing for a valid case. schema.sql.rules are not unique among multiple sql objects. This commit also adds a second sql object to test_yaml_sample in order to catch this case if rules are changed. --- sqlc/sqlc.k | 2 -- sqlc/sqlc_test.k | 12 ++++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/sqlc/sqlc.k b/sqlc/sqlc.k index 780b547c..8d51e8ae 100644 --- a/sqlc/sqlc.k +++ b/sqlc/sqlc.k @@ -21,8 +21,6 @@ schema ConfigSchema: } check: - # schema.sql.rules should be unique - isunique(allSqlRules()), "sql.rules must be unique" # schema.[rulees].name should be unique isunique(allRuleNames()) if $rules, "rules must be unique" # schema.sql.[rules] need to be present in base schema.[rules].name diff --git a/sqlc/sqlc_test.k b/sqlc/sqlc_test.k index 1393a471..602ee458 100644 --- a/sqlc/sqlc_test.k +++ b/sqlc/sqlc_test.k @@ -293,6 +293,18 @@ sql: out: "some/path" omit_unused_structs: true emit_sql_as_comment: true + - name: "test_two" + schema: "schema.sql" + queries: "query.sql" + engine: "mysql" + rules: + - no-exec-q-annotation + gen: + go: + package: "somegopkgtwo" + out: "some/pathtwo" + omit_unused_structs: true + emit_sql_as_comment: true """ cfg :ConfigSchema = yaml.decode(yl) assert len(cfg.$rules) == 1 From 3767b68361f0b5a66bb09a6985842610c7616aa0 Mon Sep 17 00:00:00 2001 From: Yvan da Silva Date: Fri, 30 Aug 2024 22:58:33 +0200 Subject: [PATCH 2/2] sqlc: increase patch version --- sqlc/kcl.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlc/kcl.mod b/sqlc/kcl.mod index ad62bef1..c17f0284 100644 --- a/sqlc/kcl.mod +++ b/sqlc/kcl.mod @@ -1,5 +1,5 @@ [package] name = "sqlc" edition = "v0.9.0" -version = "0.0.2" +version = "0.0.3" description = "sqlc.dev schema config file"