diff --git a/boilingcore/templates.go b/boilingcore/templates.go index 82c2cb9a..209f8efa 100644 --- a/boilingcore/templates.go +++ b/boilingcore/templates.go @@ -39,7 +39,6 @@ type templateData struct { RQ string // Control various generation features - // NoOutputSchema, which is also used for generation, is defined in the drivers configuration AddGlobal bool AddPanic bool AddSoftDeletes bool diff --git a/drivers/config.go b/drivers/config.go index 397f9e59..9731a6ca 100644 --- a/drivers/config.go +++ b/drivers/config.go @@ -93,21 +93,6 @@ func (c Config) DefaultString(key, def string) string { return str } -// DefaultBool retrieves a non-empty bool or the default value provided. -func (c Config) DefaultBool(key string, def bool) bool { - b, ok := c[key] - if !ok { - return def - } - - bul, ok := b.(bool) - if !ok { - return def - } - - return bul -} - // Int retrieves an int, the bool says if it exists, is of the appropriate type, // and is non-zero. Coerces float64 to int because JSON and Javascript kinda suck. func (c Config) Int(key string) (int, bool) { diff --git a/drivers/interface.go b/drivers/interface.go index e74cb413..92fec3f5 100644 --- a/drivers/interface.go +++ b/drivers/interface.go @@ -17,7 +17,6 @@ const ( ConfigBlacklist = "blacklist" ConfigWhitelist = "whitelist" ConfigSchema = "schema" - ConfigNoOutputSchema = "no-output-schema" // Determine if templates/output include a schema, even if we used one to gather info ConfigAddEnumTypes = "add-enum-types" ConfigEnumNullPrefix = "enum-null-prefix" ConfigConcurrency = "concurrency" diff --git a/drivers/sqlboiler-psql/driver/psql.go b/drivers/sqlboiler-psql/driver/psql.go index ad5e2cab..73788f96 100644 --- a/drivers/sqlboiler-psql/driver/psql.go +++ b/drivers/sqlboiler-psql/driver/psql.go @@ -97,20 +97,11 @@ func (p *PostgresDriver) Assemble(config drivers.Config) (dbinfo *drivers.DBInfo port := config.DefaultInt(drivers.ConfigPort, 5432) sslmode := config.DefaultString(drivers.ConfigSSLMode, "require") schema := config.DefaultString(drivers.ConfigSchema, "public") - noOutputSchema := config.DefaultBool(drivers.ConfigNoOutputSchema, false) whitelist, _ := config.StringSlice(drivers.ConfigWhitelist) blacklist, _ := config.StringSlice(drivers.ConfigBlacklist) concurrency := config.DefaultInt(drivers.ConfigConcurrency, drivers.DefaultConcurrency) - switch { - case noOutputSchema: - break - case schema == "public": - noOutputSchema = true - default: - // just to be explicit, even though it's the default in the getter - noOutputSchema = false - } + useSchema := schema != "public" p.addEnumTypes, _ = config[drivers.ConfigAddEnumTypes].(bool) p.enumNullPrefix = strmangle.TitleCase(config.DefaultString(drivers.ConfigEnumNullPrefix, "Null")) @@ -144,7 +135,7 @@ func (p *PostgresDriver) Assemble(config drivers.Config) (dbinfo *drivers.DBInfo RQ: '"', UseIndexPlaceholders: true, - UseSchema: !noOutputSchema, + UseSchema: useSchema, UseDefaultKeyword: true, }, } diff --git a/main.go b/main.go index cb081bda..31698e68 100644 --- a/main.go +++ b/main.go @@ -101,7 +101,6 @@ func main() { rootCmd.PersistentFlags().BoolP("no-auto-timestamps", "", false, "Disable automatic timestamps for created_at/updated_at") rootCmd.PersistentFlags().BoolP("no-driver-templates", "", false, "Disable parsing of templates defined by the database driver") rootCmd.PersistentFlags().BoolP("no-back-referencing", "", false, "Disable back referencing in the loaded relationship structs") - rootCmd.PersistentFlags().BoolP("no-schema", "", false, "Disable generating a schema in the output") rootCmd.PersistentFlags().BoolP("always-wrap-errors", "", false, "Wrap all returned errors with stacktraces, also sql.ErrNoRows") rootCmd.PersistentFlags().BoolP("add-global-variants", "", false, "Enable generation for global variants") rootCmd.PersistentFlags().BoolP("add-panic-variants", "", false, "Enable generation for panic variants") @@ -214,12 +213,11 @@ func preRun(cmd *cobra.Command, args []string) error { // Configure the driver cmdConfig.DriverConfig = map[string]interface{}{ - "whitelist": viper.GetStringSlice(driverName + ".whitelist"), - "blacklist": viper.GetStringSlice(driverName + ".blacklist"), - drivers.ConfigNoOutputSchema: viper.GetBool("no-schema"), - "add-enum-types": cmdConfig.AddEnumTypes, - "enum-null-prefix": cmdConfig.EnumNullPrefix, - "foreign-keys": cmdConfig.ForeignKeys, + "whitelist": viper.GetStringSlice(driverName + ".whitelist"), + "blacklist": viper.GetStringSlice(driverName + ".blacklist"), + "add-enum-types": cmdConfig.AddEnumTypes, + "enum-null-prefix": cmdConfig.EnumNullPrefix, + "foreign-keys": cmdConfig.ForeignKeys, } keys := allKeys(driverName)