-
-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate Relations from Current Schema exception #186
Comments
That's code from |
I fixed change in yii2-gii\generators\model\Generator.php row 455 : $schemaNames = ($this->generateRelationsFromCurrentSchema) ? [$db->schema->defaultSchema] : $this->getSchemaNames(); $schemaNames = $this->getSchemaNames(); |
Great. Could you send a pull request? |
Oh. Looking at diff I see that it has a configurable feature removed. |
$db->schema->defaultSchema must get actual table, but $this->getSchemaNames() do same. |
@zlakomanoff any comments? |
@samdark i will check and fix tomorrow |
@samdark @uldisn @cornernote @nergal @cebe MySQL $defaultSchema always is empty
I think mysql $defaultSchema must contain current database name. sqlite - the same issue, but this db have no schemas or db names (?) https://en.wikipedia.org/wiki/Database_schema I will setup empty checking for cshema names, byt i think we need discuss about this isuue. |
What steps will reproduce the problem?
Open Gii and try generate model from a MySQL5.7 table with 'Generate Relations from Current Schema' set to TRUE.
What's expected?
Generated model or correct error warning when is defaultSchema empty, or automatically set schema from connection.
What do you get instead?
Exception:
Additional info
This hapends when Yii::$app->db->schema->defaultSchema is empty. But MySQL does not use default schema for user.
This bug bring commit fb52694 with new 'Generate Relations from Current Schema' option.
The text was updated successfully, but these errors were encountered: