Closed glodov closed 1 year ago
Make sure your application has access to this database and the table.
Make sure your application has access to this database and the table.
Of course. It is.
cat config/dynamic.php
<?php return [
'components' => [
'db' => [
'class' => 'yii\\db\\Connection',
'dsn' => 'mysql:host=localhost;dbname=intranet',
'username' => 'root',
'password' => 'root',
],
...
Entering and checking with the same user with MySQL (MariaDB) console.
mysql -u root -p
MariaDB [(none)]> use intranet;
Database changed
MariaDB [intranet]> show tables like "uacademy_%";
+---------------------------------+
| Tables_in_intranet (uacademy_%) |
+---------------------------------+
| uacademy_persona |
+---------------------------------+
1 row in set (0.001 sec)
MariaDB [intranet]> select * from uacademy_persona;
Empty set (0.002 sec)
MariaDB [intranet]> insert into uacademy_persona values ();
Query OK, 1 row affected (0.003 sec)
MariaDB [intranet]> select * from uacademy_persona;
+----+
| id |
+----+
| 1 |
+----+
1 row in set (0.000 sec)
It seems framework is trying to get data from the table (even with the generator) before creating it.
Do you have other tables referencing uacademy_persona
by FK?
AFAIR gii reads all tables and sometimes mixes up table names when using ie. a table_prefix.
So far I don't see any proof that the app has access to the database, you are showing only the db console.
Make sure your application has access to this database and the table.
And today it works. After such manipulation of inserting data into the table. I think it's some kind of cache, and it would be perfect to understand which one.
Now I have removed the table and the migration generator works.
Do you have other tables referencing
uacademy_persona
by FK?AFAIR gii reads all tables and sometimes mixes up table names when using ie. a table_prefix.
Nope. Works well now.
I don't understand why it did not work yesterday.
So far I don't see any proof that the app has access to the database, you are showing only the db console.
How can I make a proof for you otherwise than a console (good to know for future reporting)?
By running some SQL query using the app. Anyway, interesting, maybe indeed DB schema cache is the reason, do you have it switched on?
By running some SQL query using the app. Anyway, interesting, maybe indeed DB schema cache is the reason, do you have it switched on?
I though so, and so I used the command from the terminal to clear the cache, but it did not help.
My config for the cache is:
<?php return [
'components' => [
'cache' => [
'class' => 'yii\\caching\\FileCache',
'keyPrefix' => 'humhub',
],
// ...
and now I have another issue with the popuping up the preview of the file. I've recorded a screen with the explanation, it is available here: https://youtu.be/86Lc_MJ9jKQ. I have my dark theme enabled (external CSS for the generator) but even with the disabled dark theme popup is not visible.
Is it possible that some Humhub component is breaking that? I'm not familiar with Humhub so I'm afraid I won't be able to help. Please double check the browser console for any network and JS errors as well.
Is it possible that some Humhub component is breaking that? I'm not familiar with Humhub so I'm afraid I won't be able to help. Please double check the browser console for any network and JS errors as well.
No errors. The response is very correct with the preview of the file, and more interesting, there is the correct HTML code generated and almost visible on the highest level with z-index, but it is transparent.
If you have time (5 minutes) to check, I've recorded another video with the research on this transparency error. Here is the video: https://youtu.be/ing9zx4bDYU.
My experience tells me it is not related to HumHub, it is pure Yii2 generator run in the browser as a part of HumHub platform.
I found an issue.
It's an opacity of the .fade
class for the modal dialog.
I shall try to make a pull request with the fix.
And again, I have the same issue after I removed the table. It makes no sense to require an existent table in the generator module. How can migrations be created then?
What do you mean? Is there a table or is there not? Do you want to generate a model based on it or a migration?
What do you mean? Is there a table or is there not? Do you want to generate a model based on it or a migration?
No table. When I created it manually it worked without any error, but migration did not run. Nothing new to migrate.
When I removed the table, it continues to show an error on the step of preview or generation of migration file.
It makes no sense to create a table manually in the database, this is why I use a migration generator to generate it without errors.
I am going to dig into the architecture of the migration process and try to fix it.
What do you mean? Is there a table or is there not? Do you want to generate a model based on it or a migration?
When the checkbox "Only by phpdoc annotation" is checked there is no error. When it's unchecked generator throws an error. Should a message or hint be added here for this checkbox?
I've spent quite some time figuring this out.
And now, I have an issue with the "object" column type.
And the yii\db\SchemaBuilderTrait
does not have such a function object()
but it has json()
which is not described in phpdoc annotation.
But it works with "json" in the way to create "longtext" in MariaDB.
What would you suggest to improve @bizley to help developers to understand this builder with no errors and with the correct json format?
We are talking here about several things at the same time so it would be nice to extract a single thing into a separate issue if you find something not working properly. As for the builder documentation I'm afraid I cannot help you with that since Gii docs are quite minimal, it would be nice to have it completed.
Thanks.
This question is already part of the migration generator module, so it's issued here https://github.com/Insolita/yii2-migrik/issues/49
What steps will reproduce the problem?
I have created a model for the Persona use (an extended version of the profile) with a more complicated structure of data. I have described a model according to insolita/yii2-migration-generator@~3.1:
I tried to run a table generator and it throws me an error: Table does not exist. Ok. I have created a table in the database with MariaDB commands in the MariaDB client, so what I have in the database:
But I had the same error again. So I have run clear cache command in the console:
But this did not help either.
What's expected?
Migration file was created to run the migration as it should work.
What do you get instead?
An error "The table does not exist: uacademy_persona"
Additional info