From a133d9014c5090d1fb0e0ab58ba51835088b63a3 Mon Sep 17 00:00:00 2001 From: Kevin Kirsche Date: Thu, 20 Jun 2019 15:44:03 -0400 Subject: [PATCH] Update database template YAML to conform to spec (#400) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * v4.11.0 (#379) * Back to development * Add Timestamps() macro when generating fizz migrations (#365) * Azure pipelines (#367) * WIP Azure pipelines * Fix typo * Fix soda install script * Fix binary name * Fix tsoda call * Build soda without modules * Use Bash to install soda * Fix pipeline * Fix soda build * Remove go module builds * Fix soda install * Install soda with go install * Fix config parse test * Do not create Docker default DBs * Remove Travis * Update badge in Readme * Remove legacy Anko format fixer (#366) It can still be called using soda fix command. * removes errors.WithStack as its noisy and makes it harder to understand (#372) * removes errors.WithStack as its noisy and makes it harder to understand * fix packr file * Add a fix for old fizz without Timestamps() (#373) * WIP fix old auto-timestamp * Use plush AST to rewrite fizz files * Fix case when files are already using t.Timestamps() * Fix Windows line breaks issue * Add a mention in godocs about the behavior on slices for executors (#375) Fixes #363. * Fix "has_one" pointer association (#378) * hasOneAssociation did not work with pointers * Bump version * Fix IdlePool option (#380) The zero value was not the same as in the stdlib and could cause perfs issues. This will now not call SetMaxIdleConns when IdlePool is set to the zero value. Fixes #376 * Bump version * Update database template YAML to conform to spec This commit updates the four database template files to begin using three hyphens, which per the YAML specification is used to signal the start of a document. While not invalid to not include this, as most of the tools don't require this to properly function, by making this change ensures that directives are properly parsed in all parsers. ``` 3.2.3.4. Directives Each document may be associated with a set of directives. A directive has a name and an optional sequence of parameters. Directives are instructions to the YAML processor, and like all other presentation details are not reflected in the YAML serialization tree or representation graph. This version of YAML defines a two directives, “YAML” and “TAG”. All other directives are reserved for future versions of YAML. ``` * Revert version change --- config_test.go | 2 +- genny/config/templates/cockroach.yml.tmpl | 1 + genny/config/templates/mysql.yml.tmpl | 1 + genny/config/templates/postgres.yml.tmpl | 1 + genny/config/templates/sqlite3.yml.tmpl | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config_test.go b/config_test.go index 24f68163..c044baca 100644 --- a/config_test.go +++ b/config_test.go @@ -11,7 +11,7 @@ import ( func Test_LoadsConnectionsFromConfig(t *testing.T) { r := require.New(t) - + r.NoError(LoadConfigFile()) if DialectSupported("sqlite3") { r.Equal(5, len(Connections)) diff --git a/genny/config/templates/cockroach.yml.tmpl b/genny/config/templates/cockroach.yml.tmpl index e842f95e..82eb12c1 100644 --- a/genny/config/templates/cockroach.yml.tmpl +++ b/genny/config/templates/cockroach.yml.tmpl @@ -1,3 +1,4 @@ +--- development: dialect: cockroach database: {{.opts.Prefix}}_development diff --git a/genny/config/templates/mysql.yml.tmpl b/genny/config/templates/mysql.yml.tmpl index bdacdabb..f43d8cd5 100644 --- a/genny/config/templates/mysql.yml.tmpl +++ b/genny/config/templates/mysql.yml.tmpl @@ -1,3 +1,4 @@ +--- development: dialect: "mysql" database: "{{.opts.Prefix}}_development" diff --git a/genny/config/templates/postgres.yml.tmpl b/genny/config/templates/postgres.yml.tmpl index 202789e9..568c4595 100644 --- a/genny/config/templates/postgres.yml.tmpl +++ b/genny/config/templates/postgres.yml.tmpl @@ -1,3 +1,4 @@ +--- development: dialect: postgres database: {{.opts.Prefix}}_development diff --git a/genny/config/templates/sqlite3.yml.tmpl b/genny/config/templates/sqlite3.yml.tmpl index 5710e636..b5b4d153 100644 --- a/genny/config/templates/sqlite3.yml.tmpl +++ b/genny/config/templates/sqlite3.yml.tmpl @@ -1,3 +1,4 @@ +--- development: dialect: "sqlite3" database: {{.opts.Root}}_{{.opts.Prefix}}_development.sqlite