Skip to content

A free open source IT asset/license management system

Added location_id to assets table to denorm

snipee8b4bdf6f403
diff --git a/database/migrations/2017_10_27_180947_denorm_asset_locations.php b/database/migrations/2017_10_27_180947_denorm_asset_locations.php
new file mode 100644
index 0000000000..b6ec3df8e4
--- /dev/null
+++ b/database/migrations/2017_10_27_180947_denorm_asset_locations.php
@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+
+class DenormAssetLocations extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ // Add a new effective location ID to flatten out the assets queries
+ Schema::table('assets', function (Blueprint $table) {
+ $table->integer('location_id')->nullable()->default(null);
+ });
+
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('assets', function (Blueprint $table) {
+ $table->dropColumn('location_id');
+ });
+ }
+}