From 48b6a0e839217a7a2c80e9a4c21a5f5c8bed1912 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 23 Jun 2025 18:01:59 +0530 Subject: [PATCH] Added check_point_names table migration --- ..._164311_create_check_point_names_table.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 database/migrations/2025_06_19_164311_create_check_point_names_table.php diff --git a/database/migrations/2025_06_19_164311_create_check_point_names_table.php b/database/migrations/2025_06_19_164311_create_check_point_names_table.php new file mode 100644 index 000000000..3c0b5d812 --- /dev/null +++ b/database/migrations/2025_06_19_164311_create_check_point_names_table.php @@ -0,0 +1,47 @@ +id(); + // $table->timestamps(); + // }); + $sql = <<<'SQL' + CREATE TABLE check_point_names ( + id BIGINT GENERATED always AS IDENTITY PRIMARY KEY, + + plant_id BIGINT NOT NULL, + + name TEXT NOT NULL, + + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP NOT NULL DEFAULT NOW(), + deleted_at TIMESTAMP, + + created_by TEXT NOT NULL, + + UNIQUE (plant_id, name), + FOREIGN KEY (plant_id) REFERENCES plants (id) + ); + SQL; + + DB::statement($sql); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('check_point_names'); + } +};