From 3b62c4a83ad12e579727636250b6bbae29db0824 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 22 Feb 2019 13:20:42 -0800 Subject: [PATCH] Fixes/integrity constraint (#6754) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Migration to fix nullables This should fix an issue introduced in 90cddb7aeeca6ca3c471ca75ab8d5fd08ba47858 where we’re passing null instead of an empty string (necessary to nullify values via the API) * Removed asset migration - serial was already fixed --- ...703_make_fields_nullable_for_integrity.php | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 database/migrations/2019_02_21_224703_make_fields_nullable_for_integrity.php diff --git a/database/migrations/2019_02_21_224703_make_fields_nullable_for_integrity.php b/database/migrations/2019_02_21_224703_make_fields_nullable_for_integrity.php new file mode 100644 index 0000000000..b9811921f7 --- /dev/null +++ b/database/migrations/2019_02_21_224703_make_fields_nullable_for_integrity.php @@ -0,0 +1,64 @@ +string('city')->nullable()->default(null)->change(); + $table->string('state')->nullable()->default(null)->change(); + $table->string('country')->nullable()->default(null)->change(); + $table->integer('user_id')->nullable()->default(null)->change(); + $table->string('address')->nullable()->default(null)->change(); + $table->string('address2')->nullable()->default(null)->change(); + }); + + Schema::table('users', function (Blueprint $table) { + $table->string('last_name')->nullable()->default(null)->change(); + }); + + Schema::table('suppliers', function (Blueprint $table) { + $table->integer('user_id')->nullable()->default(null)->change(); + }); + + Schema::table('status_labels', function (Blueprint $table) { + $table->integer('user_id')->nullable()->default(null)->change(); + }); + + Schema::table('models', function (Blueprint $table) { + $table->integer('user_id')->nullable()->default(null)->change(); + $table->integer('manufacturer_id')->nullable()->default(null)->change(); + $table->integer('category_id')->nullable()->default(null)->change(); + }); + + Schema::table('licenses', function (Blueprint $table) { + $table->integer('user_id')->nullable()->default(null)->change(); + $table->boolean('maintained')->nullable()->default(null)->change(); + }); + + Schema::table('depreciations', function (Blueprint $table) { + $table->integer('user_id')->nullable()->default(null)->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +}