Skip to content

A free open source IT asset/license management system

Added migration to store admin ID

snipeef86c0273a90
diff --git a/database/migrations/2022_06_23_164407_add_user_id_to_users.php b/database/migrations/2022_06_23_164407_add_user_id_to_users.php
new file mode 100644
index 0000000000..04a7bf68af
--- /dev/null
+++ b/database/migrations/2022_06_23_164407_add_user_id_to_users.php
@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddUserIdToUsers extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('users', function (Blueprint $table) {
+ $table->integer('created_by')->after('activated')->nullable()->default(null);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('users', function (Blueprint $table) {
+ if (Schema::hasColumn('users', 'created_by')) {
+ $table->dropColumn('created_by');
+ }
+ });
+ }
+}