From 00431f1d7be0f2c9fd0ccbe0fc5b32d7c14e0449 Mon Sep 17 00:00:00 2001 From: fox Date: Tue, 10 Sep 2019 10:49:21 +0700 Subject: [PATCH] fix for laravel 5.x --- .idea/.gitignore | 3 + .idea/composerJson.xml | 10 +++ .idea/inventory.iml | 11 ++++ .idea/laravel-plugin.xml | 8 +++ .idea/misc.xml | 6 ++ .idea/modules.xml | 8 +++ .idea/php.xml | 4 ++ .idea/vcs.xml | 6 ++ composer.json | 8 +-- ...2014_07_31_123201_create_metrics_table.php | 4 +- ...4_07_31_123204_create_categories_table.php | 4 +- ...14_07_31_123204_create_locations_table.php | 4 +- ...4_07_31_123213_create_inventory_tables.php | 18 +++--- ...3_02_143457_create_inventory_sku_table.php | 4 +- ...35351_create_inventory_supplier_tables.php | 8 +-- ...29_create_inventory_transaction_tables.php | 12 ++-- ...100032_create_inventory_variants_table.php | 2 +- ...5523_create_inventory_assemblies_table.php | 8 +-- tests/FunctionalTestCase.php | 64 +++++++++---------- 19 files changed, 124 insertions(+), 68 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/composerJson.xml create mode 100644 .idea/inventory.iml create mode 100644 .idea/laravel-plugin.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/php.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..0e40fe8f --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ + +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/.idea/composerJson.xml b/.idea/composerJson.xml new file mode 100644 index 00000000..1b074300 --- /dev/null +++ b/.idea/composerJson.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inventory.iml b/.idea/inventory.iml new file mode 100644 index 00000000..228b7064 --- /dev/null +++ b/.idea/inventory.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/laravel-plugin.xml b/.idea/laravel-plugin.xml new file mode 100644 index 00000000..cc2ce149 --- /dev/null +++ b/.idea/laravel-plugin.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..28a804d8 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..26985436 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 00000000..cd67c36e --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/composer.json b/composer.json index 217e0451..943d2478 100644 --- a/composer.json +++ b/composer.json @@ -11,13 +11,13 @@ "license": "MIT", "require": { "php": ">=5.4.0", - "illuminate/database": "4.* | 5.*", - "illuminate/support": "4.* | 5.*", + "illuminate/database": "5.*| 6.*", + "illuminate/support": "5.*| 6.*", "baum/baum": "1.0.* | 1.1.*" }, "require-dev": { - "phpunit/phpunit": "4.*", - "mockery/mockery": "0.9.*" + "phpunit/phpunit": "6.*", + "mockery/mockery": "1.*" }, "archive": { "exclude": ["/tests"] diff --git a/src/migrations/2014_07_31_123201_create_metrics_table.php b/src/migrations/2014_07_31_123201_create_metrics_table.php index e2b438b9..d763233e 100644 --- a/src/migrations/2014_07_31_123201_create_metrics_table.php +++ b/src/migrations/2014_07_31_123201_create_metrics_table.php @@ -11,10 +11,10 @@ class CreateMetricsTable extends Migration public function up() { Schema::create('metrics', function (Blueprint $table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('user_id')->unsigned()->nullable(); + $table->bigInteger('user_id')->unsigned()->nullable(); $table->string('name'); $table->string('symbol'); diff --git a/src/migrations/2014_07_31_123204_create_categories_table.php b/src/migrations/2014_07_31_123204_create_categories_table.php index efd386e5..0bf9cd00 100644 --- a/src/migrations/2014_07_31_123204_create_categories_table.php +++ b/src/migrations/2014_07_31_123204_create_categories_table.php @@ -11,9 +11,9 @@ class CreateCategoriesTable extends Migration public function up() { Schema::create('categories', function (Blueprint $table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('parent_id')->nullable()->index(); + $table->bigInteger('parent_id')->nullable()->index(); $table->integer('lft')->nullable()->index(); $table->integer('rgt')->nullable()->index(); $table->integer('depth')->nullable(); diff --git a/src/migrations/2014_07_31_123204_create_locations_table.php b/src/migrations/2014_07_31_123204_create_locations_table.php index 94dd7884..a6c2e53c 100644 --- a/src/migrations/2014_07_31_123204_create_locations_table.php +++ b/src/migrations/2014_07_31_123204_create_locations_table.php @@ -11,9 +11,9 @@ class CreateLocationsTable extends Migration public function up() { Schema::create('locations', function (Blueprint $table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('parent_id')->nullable()->index(); + $table->bigInteger('parent_id')->nullable()->index(); $table->integer('lft')->nullable()->index(); $table->integer('rgt')->nullable()->index(); $table->integer('depth')->nullable(); diff --git a/src/migrations/2014_07_31_123213_create_inventory_tables.php b/src/migrations/2014_07_31_123213_create_inventory_tables.php index 769dfc45..f3a1cbe5 100644 --- a/src/migrations/2014_07_31_123213_create_inventory_tables.php +++ b/src/migrations/2014_07_31_123213_create_inventory_tables.php @@ -11,13 +11,13 @@ class CreateInventoryTables extends Migration public function up() { Schema::create('inventories', function (Blueprint $table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); $table->softDeletes(); - $table->integer('category_id')->unsigned()->nullable(); - $table->integer('user_id')->unsigned()->nullable(); - $table->integer('metric_id')->unsigned(); + $table->bigInteger('category_id')->unsigned()->nullable(); + $table->bigInteger('user_id')->unsigned()->nullable(); + $table->bigInteger('metric_id')->unsigned(); $table->string('name'); $table->text('description')->nullable(); @@ -35,13 +35,13 @@ public function up() }); Schema::create('inventory_stocks', function (Blueprint $table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); $table->softDeletes(); - $table->integer('user_id')->unsigned()->nullable(); - $table->integer('inventory_id')->unsigned(); - $table->integer('location_id')->unsigned(); + $table->bigInteger('user_id')->unsigned()->nullable(); + $table->bigInteger('inventory_id')->unsigned(); + $table->bigInteger('location_id')->unsigned(); $table->decimal('quantity', 8, 2)->default(0); $table->string('aisle')->nullable(); $table->string('row')->nullable(); @@ -67,7 +67,7 @@ public function up() }); Schema::create('inventory_stock_movements', function (Blueprint $table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); $table->softDeletes(); diff --git a/src/migrations/2015_03_02_143457_create_inventory_sku_table.php b/src/migrations/2015_03_02_143457_create_inventory_sku_table.php index f09517cd..b22961d0 100644 --- a/src/migrations/2015_03_02_143457_create_inventory_sku_table.php +++ b/src/migrations/2015_03_02_143457_create_inventory_sku_table.php @@ -11,9 +11,9 @@ class CreateInventorySkuTable extends Migration public function up() { Schema::create('inventory_skus', function (Blueprint $table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('inventory_id')->unsigned(); + $table->bigInteger('inventory_id')->unsigned(); $table->string('code'); $table->foreign('inventory_id')->references('id')->on('inventories') diff --git a/src/migrations/2015_03_06_135351_create_inventory_supplier_tables.php b/src/migrations/2015_03_06_135351_create_inventory_supplier_tables.php index 9220816e..778061ff 100644 --- a/src/migrations/2015_03_06_135351_create_inventory_supplier_tables.php +++ b/src/migrations/2015_03_06_135351_create_inventory_supplier_tables.php @@ -11,7 +11,7 @@ class CreateInventorySupplierTables extends Migration public function up() { Schema::create('suppliers', function (Blueprint $table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); $table->string('name'); @@ -29,11 +29,11 @@ public function up() }); Schema::create('inventory_suppliers', function (Blueprint $table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('inventory_id')->unsigned(); - $table->integer('supplier_id')->unsigned(); + $table->bigInteger('inventory_id')->unsigned(); + $table->bigInteger('supplier_id')->unsigned(); $table->foreign('inventory_id')->references('id')->on('inventories') ->onUpdate('restrict') diff --git a/src/migrations/2015_03_09_122729_create_inventory_transaction_tables.php b/src/migrations/2015_03_09_122729_create_inventory_transaction_tables.php index c49cdde0..b9e70f53 100644 --- a/src/migrations/2015_03_09_122729_create_inventory_transaction_tables.php +++ b/src/migrations/2015_03_09_122729_create_inventory_transaction_tables.php @@ -11,10 +11,10 @@ class CreateInventoryTransactionTables extends Migration public function up() { Schema::create('inventory_transactions', function (Blueprint $table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('user_id')->unsigned()->nullable(); - $table->integer('stock_id')->unsigned(); + $table->bigInteger('user_id')->unsigned()->nullable(); + $table->bigInteger('stock_id')->unsigned(); $table->string('name')->nullable(); $table->string('state'); $table->decimal('quantity', 8, 2)->default(0); @@ -29,10 +29,10 @@ public function up() }); Schema::create('inventory_transaction_histories', function (Blueprint $table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('user_id')->unsigned()->nullable(); - $table->integer('transaction_id')->unsigned(); + $table->bigInteger('user_id')->unsigned()->nullable(); + $table->bigInteger('transaction_id')->unsigned(); /* * Allows tracking states for each transaction diff --git a/src/migrations/2015_05_05_100032_create_inventory_variants_table.php b/src/migrations/2015_05_05_100032_create_inventory_variants_table.php index 72393458..f70a4a8d 100644 --- a/src/migrations/2015_05_05_100032_create_inventory_variants_table.php +++ b/src/migrations/2015_05_05_100032_create_inventory_variants_table.php @@ -11,7 +11,7 @@ class CreateInventoryVariantsTable extends Migration public function up() { Schema::table('inventories', function (Blueprint $table) { - $table->integer('parent_id')->unsigned()->nullable()->after('id'); + $table->bigInteger('parent_id')->unsigned()->nullable()->after('id'); $table->foreign('parent_id')->references('id')->on('inventories') ->onUpdate('restrict') diff --git a/src/migrations/2015_05_08_115523_create_inventory_assemblies_table.php b/src/migrations/2015_05_08_115523_create_inventory_assemblies_table.php index 093bd90b..19fd7f5c 100644 --- a/src/migrations/2015_05_08_115523_create_inventory_assemblies_table.php +++ b/src/migrations/2015_05_08_115523_create_inventory_assemblies_table.php @@ -12,11 +12,11 @@ public function up() { Schema::create('inventory_assemblies', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->integer('inventory_id')->unsigned(); - $table->integer('part_id')->unsigned(); + $table->bigIncrements('id'); + $table->bigInteger('inventory_id')->unsigned(); + $table->bigInteger('part_id')->unsigned(); $table->integer('quantity')->nullable(); + $table->timestamps(); $table->foreign('inventory_id')->references('id')->on('inventories')->onDelete('cascade'); $table->foreign('part_id')->references('id')->on('inventories')->onDelete('cascade'); diff --git a/tests/FunctionalTestCase.php b/tests/FunctionalTestCase.php index a1d13fc7..8ccfd9c5 100644 --- a/tests/FunctionalTestCase.php +++ b/tests/FunctionalTestCase.php @@ -34,12 +34,12 @@ private function configureDatabase() private function migrateTables() { DB::schema()->create('users', function ($table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->string('name'); }); DB::schema()->create('metrics', function ($table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); $table->integer('user_id')->unsigned()->nullable(); $table->string('name'); @@ -51,7 +51,7 @@ private function migrateTables() }); DB::schema()->create('categories', function ($table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); $table->integer('parent_id')->nullable()->index(); $table->integer('lft')->nullable()->index(); @@ -67,9 +67,9 @@ private function migrateTables() }); DB::schema()->create('locations', function ($table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('parent_id')->nullable()->index(); + $table->bigInteger('parent_id')->nullable()->index(); $table->integer('lft')->nullable()->index(); $table->integer('rgt')->nullable()->index(); $table->integer('depth')->nullable(); @@ -83,12 +83,12 @@ private function migrateTables() }); DB::schema()->create('inventories', function ($table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); $table->softDeletes(); - $table->integer('category_id')->unsigned()->nullable(); - $table->integer('user_id')->unsigned()->nullable(); - $table->integer('metric_id')->unsigned(); + $table->bigInteger('category_id')->unsigned()->nullable(); + $table->bigInteger('user_id')->unsigned()->nullable(); + $table->bigInteger('metric_id')->unsigned(); $table->string('name'); $table->text('description')->nullable(); @@ -106,11 +106,11 @@ private function migrateTables() }); DB::schema()->create('inventory_stocks', function ($table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('user_id')->unsigned()->nullable(); - $table->integer('inventory_id')->unsigned(); - $table->integer('location_id')->unsigned(); + $table->bigInteger('user_id')->unsigned()->nullable(); + $table->bigInteger('inventory_id')->unsigned(); + $table->bigInteger('location_id')->unsigned(); $table->decimal('quantity', 8, 2)->default(0); $table->string('aisle')->nullable(); $table->string('row')->nullable(); @@ -136,10 +136,10 @@ private function migrateTables() }); DB::schema()->create('inventory_stock_movements', function ($table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('stock_id')->unsigned(); - $table->integer('user_id')->unsigned()->nullable(); + $table->bigInteger('stock_id')->unsigned(); + $table->bigInteger('user_id')->unsigned()->nullable(); $table->decimal('before', 8, 2)->default(0); $table->decimal('after', 8, 2)->default(0); $table->decimal('cost', 8, 2)->default(0)->nullable(); @@ -155,9 +155,9 @@ private function migrateTables() }); DB::schema()->create('inventory_skus', function ($table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('inventory_id')->unsigned(); + $table->bigInteger('inventory_id')->unsigned(); $table->string('code', 20); $table->foreign('inventory_id')->references('id')->on('inventories') @@ -171,7 +171,7 @@ private function migrateTables() }); DB::schema()->create('suppliers', function ($table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); $table->string('name'); @@ -189,11 +189,11 @@ private function migrateTables() }); DB::schema()->create('inventory_suppliers', function ($table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('inventory_id')->unsigned(); - $table->integer('supplier_id')->unsigned(); + $table->bigInteger('inventory_id')->unsigned(); + $table->bigInteger('supplier_id')->unsigned(); $table->foreign('inventory_id')->references('id')->on('inventories') ->onUpdate('restrict') @@ -205,10 +205,10 @@ private function migrateTables() }); DB::schema()->create('inventory_transactions', function ($table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('user_id')->unsigned()->nullable(); - $table->integer('stock_id')->unsigned(); + $table->bigInteger('user_id')->unsigned()->nullable(); + $table->bigInteger('stock_id')->unsigned(); $table->string('name')->nullable(); $table->string('state'); $table->decimal('quantity', 8, 2)->default(0); @@ -223,10 +223,10 @@ private function migrateTables() }); DB::schema()->create('inventory_transaction_histories', function ($table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('user_id')->unsigned()->nullable(); - $table->integer('transaction_id')->unsigned(); + $table->bigInteger('user_id')->unsigned()->nullable(); + $table->bigInteger('transaction_id')->unsigned(); /* * Allows tracking states for each transaction @@ -250,7 +250,7 @@ private function migrateTables() }); DB::schema()->table('inventories', function ($table) { - $table->integer('parent_id')->unsigned()->nullable()->after('id'); + $table->bigInteger('parent_id')->unsigned()->nullable()->after('id'); $table->foreign('parent_id')->references('id')->on('inventories') ->onUpdate('restrict') @@ -263,10 +263,10 @@ private function migrateTables() DB::schema()->create('inventory_assemblies', function ($table) { - $table->increments('id'); + $table->bigIncrements('id'); $table->timestamps(); - $table->integer('inventory_id')->unsigned(); - $table->integer('part_id')->unsigned(); + $table->bigInteger('inventory_id')->unsigned(); + $table->bigInteger('part_id')->unsigned(); $table->integer('quantity')->nullable(); // Extra column for testing