Blocking bake.
Description
When i try to bin/bake all AModel there is runtime exception because of "error" on not related table. it should be warning but not error. (as the tables can not be involve)
Example :
- error: [Cake\Database\Exception\DatabaseException] Cannot describe categories. It has 0 columns.
- error: [RuntimeException] ORM queries generate field aliases using the table name/alias and column name. The table alias
HttpStatusCodesUniformResourceLocatorsand columnuniform_resource_locator_idcreate an alias longer than (61). You must change the table schema in the database and shorten either the table or column identifier so they fit within the database alias limits.
Pretty sure the code loop on list and check on it instead of loop and check if table is pick.
CakePHP Version
4.3.0
PHP Version
7.*
Please describe the tables you are trying to bake.
@othercorey what information you need about the table ?
The schemas. You post an error about "unrelated tables" but gave us no information.
The schema is compose (because wip) of empty table not link in way or another. I currently have to re check to be sure. Because i also have 2 databases. I will try to do that this week-end.
ping @HumanG33k
Add it on my week todo list.
@dereuromark i just have a coworker having the same issue :
The database is seen as connected.
error: [Cake\Database\Exception\DatabaseException] Cannot describe states. It has 0 columns. in
/home/user/public_html/project/vendor/cakephp/cakephp/src/Database/Schema/Collection.php on line 120
Stack Trace:
- /home/user/public_html/project/vendor/cakephp/cakephp/src/ORM/Table.php:513
- /home/user/public_html/project/vendor/cakephp/bake/src/Command/ModelCommand.php:111
- /home/user/public_html/project/vendor/cakephp/bake/src/Command/ModelCommand.php:94
- /home/user/public_html/project/vendor/cakephp/bake/src/Command/AllCommand.php:115
- /home/user/public_html/project/vendor/cakephp/cakephp/src/Console/BaseCommand.php:190
- /home/user/public_html/project/vendor/cakephp/cakephp/src/Console/CommandRunner.php:334
- /home/user/public_html/project/vendor/cakephp/cakephp/src/Console/CommandRunner.php:172
- /home/user/public_html/project/bin/cake.php:12
the command
bin/cake bake all states
the sql script used to create
CREATE TABLE states (id uuid NOT NULL, name varchar(255) NOT NULL, description text, created timestamp, updated timestamp, PRIMARY KEY (id));
I will check right on the database if it's where the issue come from i think a error for user instead of an exeption can be great.
Ok it was an tables owner issue.
a
select * from states;
run in the "cakephp" sql user send me an error.
After changing the owner of all table of the database(which as the right owner)
it works like a charm. After fixing the issue the error message make sense but a word on the "maybe wrong rights" can be great.
I let you close issue when you read it.
Do you want i make a pull request with some additionnal text on the error ?