This is a simple package to generate schema files for your database tables.
For an example, the standard users
table in a new laravel application will
generate a file named users.schema.json
that contains the contents below.
{
"name": "users",
"schema": {
"id": "bigint",
"name": "string",
"email": "string",
"email_verified_at": "datetime",
"password": "string",
"remember_token": "string",
"created_at": "datetime",
"updated_at": "datetime"
}
}
composer require wyattcast44/laravelschema
-
Schema files will be regenerated anytime you run migrations
-
You can manually trigger a build by running the command below
php artisan schema:generate
You can publish the config file using the command below
php artisan vendor:publish --provider="WyattCast44\LaravelSchema\LaravelSchemaServiceProvider"
Once you have published the config file you can customize:
- Whether or not to automatically generate schema files when migrations are ran
- where the files will be generated, the default location is in
database\schemas
- the file extension, the default is
.schema.json
- you add any tables you would like to ignore
This package helps you quickly and easily determine what field all your database tables have and the datatype for those fields.
As a project grows generally the number of migrations does as well, this can make it hard to determine by looking in one place what the final structure of a table is. You could open a database GUI and look there, but I wanted an easier way without leaving my code editor.
I hope you find this package useful in your workflow, I know I use it daily in mine :)
Please see the changelog for more information on what has changed recently.
composer test
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email author email instead of using the issue tracker.
MIT. Please see the license file for more information.