Bake w/ specify database schema

Is it possible to specify the PostgreSQL database schema with the bake command?

I have tables in other schemas other than public in the same database that I want to bake. I am using CakePHP 4.0.6 and bake 2.0.9

You should be able to specify it with --table option.

Run bin/cake bake model --help to see all the options.

Thanks for the suggestion, I had tried that though, and it won’t find it. If my schema is called “private” and my table is called “soitem”, what would the syntax be? I tried a few variations.

This unfortunately is really holding me up though :sob:

Does --table "private.soitem" not work? If so, can you create an issue if your setup?

No, it does not, instead it just says “Choose a model to bake …”. Here is the output:

[vagrant@localhost:/path/to/my/app/]$ bin/cake bake model --table "private.soitem"
Choose a model to bake from the following:
- Categories
- GridStates
- NotesSoLines
- ProductCodes

You have to specify the model name to bake as noted in the options help.

1 Like

you’re my hero! Not only did that let me bake a non-public schema, but it also let me bake a database view into a cake model, which I also was needing to figure out, but didn’t mention. I put the command that worked for me in the issue on github. Kudos!