Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Ability to do manual or automatic migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
gnikyt committed Dec 20, 2018
1 parent 686d476 commit 772ce57
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/ShopifyApp/Middleware/AuthShop.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Closure;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Session;
Expand Down Expand Up @@ -46,7 +47,7 @@ public function handle(Request $request, Closure $next)

// Shop is OK, move on...
$response = $next($request);
if (!$response instanceof Response) {
if (!$response instanceof Response && !$response instanceof RedirectResponse) {
// We need a response object to modify headers
$response = new Response($response);
}
Expand Down
8 changes: 7 additions & 1 deletion src/ShopifyApp/ShopifyAppProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ public function boot()
], 'config');

// Database migrations
$this->loadMigrationsFrom(__DIR__.'/resources/database/migrations');
if (Config::get('shopify-app.manual_migrations')) {
$this->publishes([
__DIR__.'/resources/database/migrations' => "{$this->app->databasePath()}/migrations",
], 'migrations');
} else {
$this->loadMigrationsFrom(__DIR__.'/resources/database/migrations');
}

// Job publish
$this->publishes([
Expand Down
12 changes: 12 additions & 0 deletions src/ShopifyApp/resources/config/shopify-app.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
<?php

return [
/*
|--------------------------------------------------------------------------
| Manual migrations
|--------------------------------------------------------------------------
|
| This option option allows you to use:
| `php artisan vendor:publish --tag=migrations` to push migrations
| to your app's folder so you're free to modify before migrating.
|
*/
'manual_migrations' => (bool) env('SHOPIFY_MANUAL_MIGRATIONS', false),

/*
|--------------------------------------------------------------------------
| Namespace
Expand Down

1 comment on commit 772ce57

@ncpope
Copy link
Contributor

@ncpope ncpope commented on 772ce57 Dec 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great :) Thanks @ohmybrew !

Please sign in to comment.