Closed vjik closed 1 month ago
Should we also allow digits at the start of the table name?
Yes. Table names such as 123
are valid.
There is another issue with TableExistsHandler
https://github.com/yiisoft/yii-gii/blob/ca67155160516f6d6710a249921f36758f916291/src/Validator/TableExistsHandler.php#L28-L36
while validating, the validator itself throws an exception instead of showing the error on line 31
Error
{
"type": "Yiisoft\\Db\\Exception\\Exception",
"message": "SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'my_user'@'172.20.0.2' for table `xyz`.`abc`\nThe SQL being executed was: SHOW FULL COLUMNS FROM `xyz`.`abc`",
"code": 0,
"file": "/app/vendor/yiisoft/db/src/Exception/ConvertException.php",
"line": 42,
"trace": [...omited...],
}
I'll be handling it too.
BTW, what message we should show in this case?
BTW, what message we should show in this case?
I think need to add validator error with exception message.
Adding an exception message will not be good:
I think just setting $tableSchema
as null
should be fine, it'll fall back to the bottom part to add the message "Table "%s" does not exist."
"No access" is not "Not exist".
Yii Gii is tool for developer. Seems, show exception message in this context is OK.
Added
For example, table with scheme in PostgreSQL:
booking.room
.Need to fix
Regex
validation rule:https://github.com/yiisoft/yii-gii/blob/ca67155160516f6d6710a249921f36758f916291/src/Generator/ActiveRecord/Command.php#L26-L31