chore(migreation): mengubah timestamps
This commit is contained in:
parent
968626b4de
commit
d28aecfcfe
@ -21,7 +21,8 @@ public function up(): void
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->timestamp('last_login_at')->nullable();
|
||||
$table->timestamp('last_password_change_at')->nullable();
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
|
||||
|
||||
@ -26,7 +26,8 @@ public function up(): void
|
||||
$table->date('hire_date');
|
||||
$table->date('resign_date')->nullable();
|
||||
$table->enum('status', [EmploymentStatus::values()])->default(EmploymentStatus::PERMANENT)->comment(EmploymentStatus::comment());
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -23,7 +23,8 @@ public function up(): void
|
||||
$table->enum('status', [OutletStatus::values()])->default(OutletStatus::OPERATIONAL)->comment(OutletStatus::comment());
|
||||
$table->date('opened_date');
|
||||
$table->date('closed_date')->nullable();
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -18,7 +18,8 @@ public function up(): void
|
||||
$table->enum('day', Day::values())->comment(Day::comment());
|
||||
$table->time('open_time')->nullable();
|
||||
$table->time('close_time')->nullable();
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -15,7 +15,8 @@ public function up(): void
|
||||
$table->id();
|
||||
$table->foreignId('outlet_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name', 30);
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -16,7 +16,8 @@ public function up(): void
|
||||
$table->string('name', 50);
|
||||
$table->unsignedInteger('min_points');
|
||||
$table->unsignedInteger('max_points')->nullable();
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -27,7 +27,8 @@ public function up(): void
|
||||
$table->date('start_date');
|
||||
$table->date('end_date')->nullable();
|
||||
$table->enum('is_active', [IsActive::values()])->default(IsActive::ACTIVE)->comment(IsActive::comment());
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -17,7 +17,8 @@ public function up(): void
|
||||
$table->string('slug', 30);
|
||||
$table->text('description')->nullable();
|
||||
$table->unsignedInteger('sort_order');
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -16,7 +16,8 @@ public function up(): void
|
||||
$table->string('name', 20);
|
||||
$table->string('slug', 30);
|
||||
$table->unsignedInteger('sort_order');
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -15,7 +15,8 @@ public function up(): void
|
||||
$table->id();
|
||||
$table->foreignId('outlet_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('voucher_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,8 @@ public function up(): void
|
||||
$table->string('name', 50);
|
||||
$table->string('phone_number', 20)->nullable();
|
||||
$table->enum('gender', [Gender::values()])->comment(Gender::comment());
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -16,7 +16,8 @@ public function up(): void
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('tier_id')->constrained()->cascadeOnDelete();
|
||||
$table->unsignedInteger('total_points')->default(0);
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -16,7 +16,8 @@ public function up(): void
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('code', 20)->unique();
|
||||
$table->unsignedInteger('uses_count')->default(0);
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -15,7 +15,8 @@ public function up(): void
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('referral_code_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,8 @@ public function up(): void
|
||||
$table->string('middle_notes')->nullable();
|
||||
$table->string('top_notes')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -15,7 +15,8 @@ public function up(): void
|
||||
$table->id();
|
||||
$table->foreignId('category_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('perfume_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,8 @@ public function up(): void
|
||||
$table->foreignId('outlet_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('perfume_id')->constrained()->cascadeOnDelete();
|
||||
$table->unsignedInteger('stock')->default(0);
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,8 @@ public function up(): void
|
||||
$table->unsignedInteger('cost_price')->default(0);
|
||||
$table->unsignedInteger('sale_price')->default(0);
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -16,7 +16,8 @@ public function up(): void
|
||||
$table->foreignId('outlet_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('product_id')->constrained()->cascadeOnDelete();
|
||||
$table->unsignedInteger('stock')->default(0);
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,8 @@ public function up(): void
|
||||
$table->unsignedInteger('cost_price')->default(0);
|
||||
$table->unsignedInteger('sale_price')->default(0);
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -16,7 +16,8 @@ public function up(): void
|
||||
$table->foreignId('bottle_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('outlet_id')->constrained()->cascadeOnDelete();
|
||||
$table->unsignedInteger('stock')->default(0);
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,8 @@ public function up(): void
|
||||
$table->unsignedInteger('amount');
|
||||
$table->string('description', 100);
|
||||
$table->enum('type', ExpenseType::values())->comment(ExpenseType::comment());
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
@ -25,7 +25,8 @@ public function up(): void
|
||||
$table->bigIncrements('id'); // permission id
|
||||
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
});
|
||||
@ -39,7 +40,8 @@ public function up(): void
|
||||
}
|
||||
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
|
||||
$table->timestamps();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
@ -62,13 +64,16 @@ public function up(): void
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
$table->primary(
|
||||
[$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary'
|
||||
);
|
||||
} else {
|
||||
$table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
$table->primary(
|
||||
[$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary'
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
|
||||
@ -86,11 +91,15 @@ public function up(): void
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
$table->primary(
|
||||
[$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary'
|
||||
);
|
||||
} else {
|
||||
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
$table->primary(
|
||||
[$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user