Skip to content

Commit

Permalink
feat: Add the ability to publish migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmellor committed Mar 24, 2024
1 parent fa00118 commit d613ea8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/EngageifyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ public function boot(): void
__DIR__.'/../config/engageify.php' => config_path(path: 'engageify.php'),
], groups: 'engageify-config');

$this->loadMigrationsFrom(paths: __DIR__.'/../database/migrations');
if (method_exists(object_or_class: $this, method: 'publishesMigrations')) {
$this->publishesMigrations([
__DIR__.'/../database/migrations' => database_path(path: 'migrations'),
], groups: 'engageify-migrations');
} else {
$this->publishes([
__DIR__.'/../database/migrations' => database_path(path: 'migrations'),
], groups: 'engageify-migrations');

$this->loadMigrationsFrom(paths: __DIR__.'/../database/migrations');
}
}
}
2 changes: 2 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ protected function setUp(): void
parent::setUp();

$this->loadLaravelMigrations();

$this->loadMigrationsFrom(paths: __DIR__.'/../database/migrations');
}

protected function getPackageProviders($app): array
Expand Down

0 comments on commit d613ea8

Please sign in to comment.