diff --git a/database/migrations/2014_10_12_000000_create_tbl3_mst_users.php b/database/migrations/2014_10_12_000000_create_tbl3_mst_users.php index 31a38ff..2ef7b9e 100644 --- a/database/migrations/2014_10_12_000000_create_tbl3_mst_users.php +++ b/database/migrations/2014_10_12_000000_create_tbl3_mst_users.php @@ -14,20 +14,20 @@ return new class extends Migration public function up(): void { $schema = function (Blueprint $table, MigrationHelper $helper) { - $helper = new MigrationHelper($table); $helper->baseColumn() ->shopId(true); $table->string('name')->nullable()->comment("名前"); $table->string('role')->comment("権限"); - $table->unsignedInteger('customer_id')->comment("顧客ID"); - $table->string('customer_code')->comment("顧客コード"); + $table->unsignedInteger('customer_id')->nullable()->comment("顧客ID"); + $table->string('customer_code')->nullable()->comment("顧客コード"); $table->string('email')->comment("Email"); $table->text('password')->nullable()->comment("ログインパスワード"); }; MigrationHelper::createTable("tbl3_mst_users", $schema, "HTD ログインユーザー"); - MigrationHelper::createTable("tbl3_mst_shop_histories", $schema, "HTD ログインユーザー履歴"); + MigrationHelper::createTable("tbl3_mst_user_histories", $schema, "HTD ログインユーザー履歴"); + MigrationHelper::addUnique("tbl3_mst_users", 1, ["email"]); } @@ -38,6 +38,6 @@ return new class extends Migration public function down(): void { Schema::dropIfExists('tbl3_mst_users'); - Schema::dropIfExists('tbl3_mst_shop_histories'); + Schema::dropIfExists('tbl3_mst_user_histories'); } };