laravel-generator
laravel-generator copied to clipboard
Generate using --fromTable using large database
Hi, thanks for this awesome project. I'm trying to create files using this command:
php artisan infyom:api MyClass --fromTable --tableName="lv_my_table"
But nothing happened on my terminal, like something was being processed in the background. So I've started to investigate and I discover that: when you use the --fromTable parameter, Infyom use the current connection to list all tables, all fields and all relations to generate the data.
#vendor/infyomlabs/laravel-generator/src/Utils/TableFieldsGenerator.php:304
/**
* Prepares foreign keys from table with required details.
*
* @return GeneratorTable[]
*/
public function prepareForeignKeys()
{
$tables = $this->schemaManager->listTables();
However, this is very consuming because our database has more than 600 tables, distributed in different schemas. How can I limit Infyom to look into only on laravel default schema? Or even create a cache or something else that makes the process faster?
@carlossantoswd I think at the moment, its happening to prepare relations and foreign keys. I will look into how we can limit it.
Right now we are busy in finishing some major updates. once that is done, I will consider limiting this to only foreign keys of the current table.
Even I think this code was contributed by someone from open source. so I have very less idea about this. so far we didn't get any complaints, maybe because nobody tried with this kind of large database.
Will update you once I got it. Or feel free to fork the current repo and contribute a solution.
The solution will be instead of listing all tables, you just list tables for all foreign keys.