Code generation not obeying configuration
Closed this issue · 1 comments
patrickarmengol commented
Not sure if this is a misunderstanding on my part, but I can't seem to get the generation to follow my desired configuration in bobgen.yaml
as documented at https://bob.stephenafamo.com/docs/code-generation/psql
Here's my config file:
psql:
except:
public.schema_migrations:
public.sessions:
output: "internal/models"
no_factory: true
Here's the output from the generation:
PSQL_DSN=$CT_DB_DSN go run github.com/stephenafamo/bob/gen/bobgen-psql@latest -c ./bobgen.yaml
535 bytes internal/models/bob_enums.go
3240 bytes internal/models/bob_main.go
13111 bytes internal/models/beans.go
12338 bytes internal/models/permissions.go
14083 bytes internal/models/roasters.go
5813 bytes internal/models/schema_migrations.go
5798 bytes internal/models/sessions.go
15459 bytes internal/models/users.go
17131 bytes internal/models/users_permissions.go
967 bytes internal/models/factory/bobfactory_context.go
140 bytes internal/models/factory/bobfactory_enums.go
3236 bytes internal/models/factory/bobfactory_main.go
1851 bytes internal/models/factory/bobfactory_random.go
1945 bytes internal/models/factory/bobfactory_random_test.go
13131 bytes internal/models/factory/beans.go
9509 bytes internal/models/factory/permissions.go
15645 bytes internal/models/factory/roasters.go
8334 bytes internal/models/factory/schema_migrations.go
8704 bytes internal/models/factory/sessions.go
15077 bytes internal/models/factory/users.go
11005 bytes internal/models/factory/users_permissions.go
Here are the desired effects of the config and their results:
- [FAILED] - ignoring
schema_migrations
andsessions
tables - [PASSED] - setting the output path to
internal/models
- [FAILED] - not generating factory
stephenafamo commented
You should change your configuration to this:
no_factory: true
psql:
except:
schema_migrations:
sessions:
output: "internal/models"
no_factory
is a top level config. I will correct the documentation on this.- The schema prefix is only needed if you are generating for a schema that is not the "shared_schema". In this case, you don't need it.
Sorry about the confusion, let me know if the tweaked configuration works.