Skip to content
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 using --fromTable using large database #1028

Open
carlosapenasdev opened this issue Jul 13, 2022 · 1 comment
Open

Generate using --fromTable using large database #1028

carlosapenasdev opened this issue Jul 13, 2022 · 1 comment

Comments

@carlosapenasdev
Copy link

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?

@mitulgolakiya
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants