From f04bf74026a07f5eef76452ae1a596c2f9076f63 Mon Sep 17 00:00:00 2001 From: JonatanRek Date: Tue, 30 Jul 2024 10:44:58 +0200 Subject: [PATCH] Models & Migrations --- app/Models/Host.php | 11 ++++++ app/Models/Maintenance.php | 11 ++++++ app/Models/MaintenanceHistory.php | 11 ++++++ app/Models/MaintenanceHostHistory.php | 11 ++++++ app/Models/MaintenanceTask.php | 11 ++++++ app/Models/MaintenanceTaskHistory.php | 11 ++++++ .../2024_07_30_083512_create_hosts_table.php | 28 +++++++++++++++ ..._083526_create_maintenance_tasks_table.php | 29 +++++++++++++++ ...07_30_083536_create_maintenances_table.php | 30 ++++++++++++++++ ...reate_maintenance_task_histories_table.php | 35 +++++++++++++++++++ ...555_create_maintenance_histories_table.php | 33 +++++++++++++++++ ...reate_maintenance_host_histories_table.php | 31 ++++++++++++++++ 12 files changed, 252 insertions(+) create mode 100644 app/Models/Host.php create mode 100644 app/Models/Maintenance.php create mode 100644 app/Models/MaintenanceHistory.php create mode 100644 app/Models/MaintenanceHostHistory.php create mode 100644 app/Models/MaintenanceTask.php create mode 100644 app/Models/MaintenanceTaskHistory.php create mode 100644 database/migrations/2024_07_30_083512_create_hosts_table.php create mode 100644 database/migrations/2024_07_30_083526_create_maintenance_tasks_table.php create mode 100644 database/migrations/2024_07_30_083536_create_maintenances_table.php create mode 100644 database/migrations/2024_07_30_083546_create_maintenance_task_histories_table.php create mode 100644 database/migrations/2024_07_30_083555_create_maintenance_histories_table.php create mode 100644 database/migrations/2024_07_30_083607_create_maintenance_host_histories_table.php diff --git a/app/Models/Host.php b/app/Models/Host.php new file mode 100644 index 0000000..6108d13 --- /dev/null +++ b/app/Models/Host.php @@ -0,0 +1,11 @@ +id(); + $table->string('hostname'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('hosts'); + } +}; diff --git a/database/migrations/2024_07_30_083526_create_maintenance_tasks_table.php b/database/migrations/2024_07_30_083526_create_maintenance_tasks_table.php new file mode 100644 index 0000000..bc20c62 --- /dev/null +++ b/database/migrations/2024_07_30_083526_create_maintenance_tasks_table.php @@ -0,0 +1,29 @@ +id(); + $table->string('hostname'); + $table->text('description'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('maintenance_tasks'); + } +}; diff --git a/database/migrations/2024_07_30_083536_create_maintenances_table.php b/database/migrations/2024_07_30_083536_create_maintenances_table.php new file mode 100644 index 0000000..ceffb99 --- /dev/null +++ b/database/migrations/2024_07_30_083536_create_maintenances_table.php @@ -0,0 +1,30 @@ +id(); + $table->string('name'); + $table->text('description'); + $table->string('schedule'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('maintenances'); + } +}; diff --git a/database/migrations/2024_07_30_083546_create_maintenance_task_histories_table.php b/database/migrations/2024_07_30_083546_create_maintenance_task_histories_table.php new file mode 100644 index 0000000..b351a99 --- /dev/null +++ b/database/migrations/2024_07_30_083546_create_maintenance_task_histories_table.php @@ -0,0 +1,35 @@ +id(); + $table->foreignIdFor(Task::class); + $table->foreignIdFor(MaintenanceHistory::class); + $table->foreignIdFor(Host::class); + $table->string('status'); + $table->datetime('finished_at'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('maintenance_task_histories'); + } +}; diff --git a/database/migrations/2024_07_30_083555_create_maintenance_histories_table.php b/database/migrations/2024_07_30_083555_create_maintenance_histories_table.php new file mode 100644 index 0000000..274aede --- /dev/null +++ b/database/migrations/2024_07_30_083555_create_maintenance_histories_table.php @@ -0,0 +1,33 @@ +id(); + $table->foreignIdFor(Maintenance::class); + $table->foreignIdFor(User::class); + $table->datetime('start_at'); + $table->datetime('finished_at'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('maintenance_histories'); + } +}; diff --git a/database/migrations/2024_07_30_083607_create_maintenance_host_histories_table.php b/database/migrations/2024_07_30_083607_create_maintenance_host_histories_table.php new file mode 100644 index 0000000..3f80778 --- /dev/null +++ b/database/migrations/2024_07_30_083607_create_maintenance_host_histories_table.php @@ -0,0 +1,31 @@ +id(); + $table->foreignIdFor(Maintenance::class); + $table->foreignIdFor(Host::class); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('maintenance_host_histories'); + } +};