From d985d493a3fdcf4524f67ce0d75f5e4523e8a8d5 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 24 Oct 2018 13:35:31 +0200 Subject: [PATCH] Migrations: Added namespace --- composer.json | 5 +++-- db/migrations/2018_01_01_000001_import_install_sql.php | 2 ++ db/migrations/2018_01_01_000002_import_update_sql.php | 2 ++ db/migrations/2018_01_01_000003_fix_old_tables.php | 2 ++ db/migrations/2018_08_30_000000_create_log_entries_table.php | 2 ++ db/migrations/2018_09_11_000000_create_sessions_table.php | 2 ++ src/Database/Migration/Migrate.php | 2 +- tests/Unit/Database/Migration/MigrationTest.php | 2 +- .../Stub/2001_04_11_123456_create_lorem_ipsum_table.php | 2 ++ .../Migration/Stub/2017_12_24_053300_another_stuff.php | 2 ++ .../Migration/Stub/2022_12_22_221222_add_some_feature.php | 2 ++ 11 files changed, 21 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 681d3ccf..f6df5ee1 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "erusev/parsedown": "^1.6", "illuminate/container": "5.5.*", "illuminate/database": "5.5.*", - "illuminate/support": "^5.5", + "illuminate/support": "5.5.*", "nikic/fast-route": "^1.3", "psr/container": "^1.0", "psr/http-server-middleware": "^1.0", @@ -44,7 +44,8 @@ }, "autoload": { "psr-4": { - "Engelsystem\\": "src/" + "Engelsystem\\": "src/", + "Engelsystem\\Migrations\\": "db/migrations" }, "files": [ "src/helpers.php" diff --git a/db/migrations/2018_01_01_000001_import_install_sql.php b/db/migrations/2018_01_01_000001_import_install_sql.php index bd7ec7ae..eae8c810 100644 --- a/db/migrations/2018_01_01_000001_import_install_sql.php +++ b/db/migrations/2018_01_01_000001_import_install_sql.php @@ -1,5 +1,7 @@ app->make($className); + $class = $this->app->make('Engelsystem\\Migrations\\' . $className); if (method_exists($class, $type)) { $class->{$type}(); diff --git a/tests/Unit/Database/Migration/MigrationTest.php b/tests/Unit/Database/Migration/MigrationTest.php index 43bded09..2fa1b6c0 100644 --- a/tests/Unit/Database/Migration/MigrationTest.php +++ b/tests/Unit/Database/Migration/MigrationTest.php @@ -2,7 +2,7 @@ namespace Engelsystem\Test\Unit\Database; -use AnotherStuff; +use Engelsystem\Migrations\AnotherStuff; use Illuminate\Database\Schema\Builder as SchemaBuilder; use PHPUnit\Framework\MockObject\MockBuilder; use PHPUnit\Framework\TestCase; diff --git a/tests/Unit/Database/Migration/Stub/2001_04_11_123456_create_lorem_ipsum_table.php b/tests/Unit/Database/Migration/Stub/2001_04_11_123456_create_lorem_ipsum_table.php index 0cc89e07..307b776e 100644 --- a/tests/Unit/Database/Migration/Stub/2001_04_11_123456_create_lorem_ipsum_table.php +++ b/tests/Unit/Database/Migration/Stub/2001_04_11_123456_create_lorem_ipsum_table.php @@ -1,5 +1,7 @@