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

单表怎么生成? #23

Closed
wlzxdm opened this issue May 1, 2023 · 2 comments
Closed

单表怎么生成? #23

wlzxdm opened this issue May 1, 2023 · 2 comments

Comments

@wlzxdm
Copy link

wlzxdm commented May 1, 2023

您好,问下单表怎么生成?全部生成已经有的不会覆盖,每次都新加。

@JaguarJack
Copy link
Owner

       $migrateGenerator = (new MigrateGenerator('laravel'));

        $tables = $migrateGenerator->getDatabase()->getAllTables();

        foreach ($tables as $key => $table) {

            file_put_contents(database_path( 'migrations/')  . date('Y_m_d_His') . '_' . $table->getName(). '.php' ,

                $migrateGenerator->getMigrationContent($table));

            $this->info(sprintf('%s table migration file generated', $table->getName()));
        }

目前没有单独生成的 command,但是你可以根绝上面的代码,单独写一个单表生成的,只需要给出表名就行

@wlzxdm
Copy link
Author

wlzxdm commented May 1, 2023 via email

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

No branches or pull requests

2 participants