From 596ddc0f152b5c5d16d538135f29f66574884dd7 Mon Sep 17 00:00:00 2001 From: Sam Marks Date: Mon, 19 Oct 2015 11:03:59 -0400 Subject: [PATCH 1/7] Use Laravel's publishing features to make copying the migrations a little easier. --- .../Revisionable/RevisionableServiceProvider.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/Venturecraft/Revisionable/RevisionableServiceProvider.php diff --git a/src/Venturecraft/Revisionable/RevisionableServiceProvider.php b/src/Venturecraft/Revisionable/RevisionableServiceProvider.php new file mode 100644 index 00000000..ef69cab9 --- /dev/null +++ b/src/Venturecraft/Revisionable/RevisionableServiceProvider.php @@ -0,0 +1,15 @@ +publishes([ + __DIR__ . '/../../migrations/' => database_path('/migrations') + ], 'migrations'); + } +} From cf2b9df8adb3505854d16c01b6b333e92289a11f Mon Sep 17 00:00:00 2001 From: Sam Marks Date: Mon, 19 Oct 2015 11:06:40 -0400 Subject: [PATCH 2/7] Update the readme to reflect the new workflow. --- readme.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index 3e4a944a..a56fe9fc 100644 --- a/readme.md +++ b/readme.md @@ -41,15 +41,18 @@ Run composer update to download the package php composer.phar update ``` -Finally, you'll also need to run migration on the package +After updating composer, add the service provider to the `providers` array in `config/app.php` -``` -php artisan migrate --package=venturecraft/revisionable +```php +Venturecraft\Revisionable\RevisionableServiceProvider::class, ``` -> If you're going to be migrating up and down completely a lot (using `migrate:refresh`), one thing you can do instead is to copy the migration file from the package to your `app/database` folder, and change the classname from `CreateRevisionsTable` to something like `CreateRevisionTable` (without the 's', otherwise you'll get an error saying there's a duplicate class) +Finally, publish the migrations and then migrate. -> `cp vendor/venturecraft/revisionable/src/migrations/2013_04_09_062329_create_revisions_table.php app/database/migrations/` +``` +php artisan vendor:publish --provider="Venturecraft\Revisionable\RevisionableServiceProvider" +php artisan migrate +``` ## Docs From 857fdcfa15eb1ed1608aa93fe5aae5afb5d353a3 Mon Sep 17 00:00:00 2001 From: Sam Marks Date: Mon, 19 Oct 2015 11:12:48 -0400 Subject: [PATCH 3/7] Forgot register. --- .../Revisionable/RevisionableServiceProvider.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Venturecraft/Revisionable/RevisionableServiceProvider.php b/src/Venturecraft/Revisionable/RevisionableServiceProvider.php index ef69cab9..8d09abfa 100644 --- a/src/Venturecraft/Revisionable/RevisionableServiceProvider.php +++ b/src/Venturecraft/Revisionable/RevisionableServiceProvider.php @@ -12,4 +12,9 @@ public function boot() __DIR__ . '/../../migrations/' => database_path('/migrations') ], 'migrations'); } + + public function register() + { + + } } From 37cc657af761e8155e1771c89ed6711adb80110e Mon Sep 17 00:00:00 2001 From: Sam Marks Date: Mon, 19 Oct 2015 12:51:55 -0400 Subject: [PATCH 4/7] Move the database migrations so that they don't get included in an autoloader. --- .../migrations/2013_04_09_062329_create_revisions_table.php | 0 src/Venturecraft/Revisionable/RevisionableServiceProvider.php | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename {src => database}/migrations/2013_04_09_062329_create_revisions_table.php (100%) diff --git a/src/migrations/2013_04_09_062329_create_revisions_table.php b/database/migrations/2013_04_09_062329_create_revisions_table.php similarity index 100% rename from src/migrations/2013_04_09_062329_create_revisions_table.php rename to database/migrations/2013_04_09_062329_create_revisions_table.php diff --git a/src/Venturecraft/Revisionable/RevisionableServiceProvider.php b/src/Venturecraft/Revisionable/RevisionableServiceProvider.php index 8d09abfa..0b4a3800 100644 --- a/src/Venturecraft/Revisionable/RevisionableServiceProvider.php +++ b/src/Venturecraft/Revisionable/RevisionableServiceProvider.php @@ -9,7 +9,7 @@ class RevisionableServiceProvider extends ServiceProvider public function boot() { $this->publishes([ - __DIR__ . '/../../migrations/' => database_path('/migrations') + __DIR__ . '/../../../database/migrations/' => database_path('/migrations') ], 'migrations'); } From 974a0b06b2885317c046840fcdc0b1340d8e12b0 Mon Sep 17 00:00:00 2001 From: Sam Marks Date: Mon, 19 Oct 2015 12:53:47 -0400 Subject: [PATCH 5/7] Update composer.json to reflect new classmap. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 52677d68..df670364 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ }, "autoload": { "classmap": [ - "src/migrations" + "database/migrations" ], "psr-0": { "Venturecraft\\Revisionable": "src/" From e9c8adc3c4ae225904d41a44f16c4ddf3972de1c Mon Sep 17 00:00:00 2001 From: Sam Marks Date: Mon, 19 Oct 2015 12:56:15 -0400 Subject: [PATCH 6/7] One more time. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index df670364..cc08f3fd 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ }, "autoload": { "classmap": [ - "database/migrations" + "database" ], "psr-0": { "Venturecraft\\Revisionable": "src/" From 8fed124874e85c5d3a311d51ac24060058d79e89 Mon Sep 17 00:00:00 2001 From: Sam Marks Date: Mon, 19 Oct 2015 12:58:30 -0400 Subject: [PATCH 7/7] Remove the classmap entirely. --- composer.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/composer.json b/composer.json index cc08f3fd..c8732f81 100644 --- a/composer.json +++ b/composer.json @@ -19,9 +19,6 @@ "illuminate/support": "~4.0|~5.0|~5.1" }, "autoload": { - "classmap": [ - "database" - ], "psr-0": { "Venturecraft\\Revisionable": "src/" }