Skip to content

Commit

Permalink
Add migrations config.
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Apr 8, 2021
1 parent 3bbfe7d commit ed8ab83
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ And if you want to custom the migration of the versions table, you can publish t
$ php artisan vendor:publish --provider="Overtrue\LaravelVersionable\ServiceProvider" --tag=migrations
```

> After you published the migration files, please update `'migrations' => false` in the config file `config/versionable.php` to disable load the package migrations.
Then run this command to create a database migration:

```bash
Expand Down
6 changes: 6 additions & 0 deletions config/versionable.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?php

return [
/**
* Load migrations from package migrations,
* if You published the migration files, please set to `false`.
*/
'migrations' => true,

/*
* Keep versions, you can redefine in target model.
* Default: 0 - Keep all versions.
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
public function boot()
{
$this->loadMigrationsFrom(__DIR__.'/../migrations');
\config('versionable.migrations') && $this->loadMigrationsFrom(__DIR__.'/../migrations');

$this->publishes([
__DIR__.'/../migrations' => \database_path('migrations'),
Expand Down

0 comments on commit ed8ab83

Please sign in to comment.