{"id":13592050,"url":"https://github.com/kitloong/laravel-migrations-generator","last_synced_at":"2025-05-13T19:16:59.771Z","repository":{"id":37005346,"uuid":"248276390","full_name":"kitloong/laravel-migrations-generator","owner":"kitloong","description":"Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.","archived":false,"fork":false,"pushed_at":"2024-10-18T16:06:47.000Z","size":1240,"stargazers_count":2488,"open_issues_count":0,"forks_count":274,"subscribers_count":44,"default_branch":"7.x","last_synced_at":"2024-10-29T11:58:09.930Z","etag":null,"topics":["database-migrations","existing-database","laravel","lumen","migrations"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kitloong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"kitloong","buy_me_a_coffee":"kitloong"}},"created_at":"2020-03-18T15:53:46.000Z","updated_at":"2024-10-26T22:59:45.000Z","dependencies_parsed_at":"2024-02-25T16:33:11.642Z","dependency_job_id":"a6bf5e76-2653-48e6-8374-48b106e34296","html_url":"https://github.com/kitloong/laravel-migrations-generator","commit_stats":{"total_commits":632,"total_committers":37,"mean_commits":17.08108108108108,"dds":0.444620253164557,"last_synced_commit":"b71f2e7eeba81e56c01a5a4c6f7e06264a6df194"},"previous_names":[],"tags_count":58,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitloong%2Flaravel-migrations-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitloong%2Flaravel-migrations-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitloong%2Flaravel-migrations-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitloong%2Flaravel-migrations-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kitloong","download_url":"https://codeload.github.com/kitloong/laravel-migrations-generator/tar.gz/refs/heads/7.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247909201,"owners_count":21016479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database-migrations","existing-database","laravel","lumen","migrations"],"created_at":"2024-08-01T16:01:05.244Z","updated_at":"2025-04-08T19:16:16.094Z","avatar_url":"https://github.com/kitloong.png","language":"PHP","funding_links":["https://github.com/sponsors/kitloong","https://buymeacoffee.com/kitloong"],"categories":["PHP","Development"],"sub_categories":["Generator"],"readme":"# Laravel Migrations Generator\n\n![Style check CI](https://github.com/kitloong/laravel-migrations-generator/actions/workflows/lint.yml/badge.svg?branch=7.x)\n![Tests CI](https://github.com/kitloong/laravel-migrations-generator/actions/workflows/tests.yml/badge.svg?branch=7.x)\n[![codecov](https://codecov.io/gh/kitloong/laravel-migrations-generator/branch/7.x/graph/badge.svg?token=U6ZRDPY6QZ)](https://codecov.io/gh/kitloong/laravel-migrations-generator)\n[![Latest Stable Version](https://poser.pugx.org/kitloong/laravel-migrations-generator/v)](https://packagist.org/packages/kitloong/laravel-migrations-generator)\n[![Total Downloads](https://poser.pugx.org/kitloong/laravel-migrations-generator/downloads?1)](https://packagist.org/packages/kitloong/laravel-migrations-generator)\n[![License](https://poser.pugx.org/kitloong/laravel-migrations-generator/license)](LICENSE)\n\nGenerate Laravel Migrations from an existing database, including indexes and foreign keys!\n\n## Documentation\n\nCheckout the [documentation](https://kitloong.github.io/laravel-migrations-generator/usage/) for more details.\n\n## Supported Database\n\nLaravel Migrations Generator supports all five Laravel first-party support databases:\n\n- [x] MariaDB\n- [x] MySQL\n- [x] PostgreSQL\n- [x] SQL Server\n- [x] SQLite\n\n## Install\n\nThe recommended way to install this is through composer:\n\n```bash\ncomposer require --dev kitloong/laravel-migrations-generator\n```\n\n### Laravel Setup\n\nLaravel will automatically register service provider for you.\n\n### Lumen Setup\n\n\u003cdetails\u003e\n  \u003csummary\u003eExpand\u003c/summary\u003e\n\nAuto-discovery is not available in Lumen, you need some modification on `bootstrap/app.php`.\n\n#### Enable Facade\n\nUncomment the following line.\n\n```php\n$app-\u003ewithFacades();\n```\n\n#### Register Provider\n\nAdd following line into the `Register Service Providers` section.\n\n```php\n$app-\u003eregister(\\KitLoong\\MigrationsGenerator\\MigrationsGeneratorServiceProvider::class);\n```\n\n\u003c/details\u003e\n\n## Usage\n\nTo generate migrations from a database, you need to have your database setup in Laravel's config (`config/database.php`).\n\nTo create migrations for all the tables, run:\n\n```bash\nphp artisan migrate:generate\n```\n\nYou can specify the tables you wish to generate using:\n\n```bash\nphp artisan migrate:generate --tables=\"table1,table2,table3,table4,table5\"\n```\n\nYou can also ignore tables with:\n\n```bash\nphp artisan migrate:generate --ignore=\"table3,table4,table5\"\n```\n\nLaravel Migrations Generator will first generate all the tables, columns and indexes, and afterward setup all the foreign key constraints.\n\nSo make sure you include all the tables listed in the foreign keys so that they are present when the foreign keys are created.\n\nYou can also specify the connection name if you are not using your default connection with:\n\n```bash\nphp artisan migrate:generate --connection=\"connection_name\"\n```\n\n### Squash Migrations\n\nBy default, Generator will generate multiple migration files for each table.\n\nYou can squash all migrations into a single file with:\n\n```bash\nphp artisan migrate:generate --squash\n```\n\n### Options\n\nRun `php artisan help migrate:generate` for a list of options.\n\n| Options                                                                                                                | Description                                                                                                                                                   |\n|------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [-c, --connection[=CONNECTION]](https://kitloong.github.io/laravel-migrations-generator/options/connection/)           | The database connection to use                                                                                                                                |\n| [-t, --tables[=TABLES]](https://kitloong.github.io/laravel-migrations-generator/options/tables/)                       | A list of tables or views you wish to generate migrations for separated by a comma: users,posts,comments                                                      |\n| [-i, --ignore[=IGNORE]](https://kitloong.github.io/laravel-migrations-generator/options/ignore/)                       | A list of tables or views you wish to ignore, separated by a comma: users,posts,comments                                                                      |\n| [-p, --path[=PATH]](https://kitloong.github.io/laravel-migrations-generator/options/path/)                             | Where should the file be created?                                                                                                                             |\n| [-tp, --template-path[=TEMPLATE-PATH]](https://kitloong.github.io/laravel-migrations-generator/options/template-path/) | The location of the template for this generator                                                                                                               |\n| [--date[=DATE]](https://kitloong.github.io/laravel-migrations-generator/options/date/)                                 | Migrations will be created with specified date. Views and foreign keys will be created with + 1 second. Date should be in format supported by `Carbon::parse` |\n| [--table-filename[=TABLE-FILENAME]](https://kitloong.github.io/laravel-migrations-generator/options/table-filename/)   | Define table migration filename, default pattern: `[datetime]\\_create_[name]_table.php`                                                                       |\n| [--view-filename[=VIEW-FILENAME]](https://kitloong.github.io/laravel-migrations-generator/options/table-filename/)     | Define view migration filename, default pattern: `[datetime]\\_create_[name]_view.php`                                                                         |\n| [--proc-filename[=PROC-FILENAME]](https://kitloong.github.io/laravel-migrations-generator/options/table-filename/)     | Define stored procedure filename, default pattern: `[datetime]\\_create_[name]_proc.php`                                                                       |\n| [--fk-filename[=FK-FILENAME]](https://kitloong.github.io/laravel-migrations-generator/options/table-filename/)         | Define foreign key migration filename, default pattern: `[datetime]\\_add_foreign_keys_to_[name]_table.php`                                                    |\n| [--log-with-batch[=LOG-WITH-BATCH]](https://kitloong.github.io/laravel-migrations-generator/options/log-with-batch/)   | Log migrations with given batch number. We recommend using batch number 0 so that it becomes the first migration                                              |\n| [--default-index-names](https://kitloong.github.io/laravel-migrations-generator/options/default-index-names/)          | Don\\'t use DB index names for migrations                                                                                                                      |\n| [--default-fk-names](https://kitloong.github.io/laravel-migrations-generator/options/default-fk-names/)                | Don\\'t use DB foreign key names for migrations                                                                                                                |\n| [--use-db-collation](https://kitloong.github.io/laravel-migrations-generator/options/use-db-collation/)                | Generate migrations with existing DB collation                                                                                                                |\n| [--skip-log](https://kitloong.github.io/laravel-migrations-generator/options/skip-log/)                                | Don\\'t log into migrations table                                                                                                                              |\n| [--skip-vendor](https://kitloong.github.io/laravel-migrations-generator/options/skip-vendor/)                          | Don\\'t generate vendor migrations                                                                                                                             |\n| [--skip-views](https://kitloong.github.io/laravel-migrations-generator/options/skip-views/)                            | Don\\'t generate views                                                                                                                                         |\n| [--skip-proc](https://kitloong.github.io/laravel-migrations-generator/options/skip-proc/)                              | Don\\'t generate stored procedures                                                                                                                             |\n| [--squash](https://kitloong.github.io/laravel-migrations-generator/options/squash/)                                    | Generate all migrations into a single file                                                                                                                    |\n| [--with-has-table](https://kitloong.github.io/laravel-migrations-generator/options/with-has-table/)                    | Check for the existence of a table using `hasTable`                                                                                                           |\n\n## Thank You\n\nThanks to Bernhard Breytenbach for his great work. This package is based on https://github.com/Xethron/migrations-generator.\n\n## Our Amazing Sponsor 🎉\n\nA huge thank you to our sponsor for supporting this project!\n\n\u003ca href=\"https://vemto.app/\" target=\"_blank\"\u003e\n    \u003cimg alt=\"Vemto\" width=\"200\" src=\"https://vemto.app/images/logo2.png\" /\u003e\n\u003c/a\u003e\n\nWant to support this project? [Become a sponsor](https://github.com/sponsors/kitloong) today!\n\n## Contributors\n\n[![Contributors](https://contrib.rocks/image?repo=kitloong/laravel-migrations-generator)](https://github.com/kitloong/laravel-migrations-generator/graphs/contributors)\n\n## License\n\nThe Laravel Migrations Generator is open-sourced software licensed under the [MIT license](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitloong%2Flaravel-migrations-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitloong%2Flaravel-migrations-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitloong%2Flaravel-migrations-generator/lists"}