diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-19 09:44:28 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-06-19 09:44:28 +0000 |
| commit | 95bbe9c583ff841220da1267630e7b2025fc36dc (patch) | |
| tree | 5e3d5bb3302530bbaa7f7abbe8c9cf8193ccbd4c /db/migrations/0149_sour_fallen_one.sql | |
| parent | 0eb030580b5cbe5f03d570c3c9d8c519bac3b783 (diff) | |
(대표님) 20250619 1844 KST 작업사항
Diffstat (limited to 'db/migrations/0149_sour_fallen_one.sql')
| -rw-r--r-- | db/migrations/0149_sour_fallen_one.sql | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/db/migrations/0149_sour_fallen_one.sql b/db/migrations/0149_sour_fallen_one.sql new file mode 100644 index 00000000..19f1f999 --- /dev/null +++ b/db/migrations/0149_sour_fallen_one.sql @@ -0,0 +1,2 @@ +DROP VIEW "public"."esg_evaluations_view";--> statement-breakpoint +CREATE VIEW "public"."esg_evaluations_view" AS (select "esg_evaluations"."id", "esg_evaluations"."serial_number", "esg_evaluations"."category", "esg_evaluations"."inspection_item", "esg_evaluations"."is_active", "esg_evaluations"."created_at", "esg_evaluations"."updated_at", count(distinct "esg_evaluation_items"."id") as "total_evaluation_items", count("esg_answer_options"."id") as "total_answer_options", coalesce(sum("esg_answer_options"."score"), 0) as "max_possible_score", array_agg(distinct ("esg_evaluation_items"."evaluation_item", "esg_evaluation_items"."order_index") order by ("esg_evaluation_items"."evaluation_item", "esg_evaluation_items"."order_index")) filter (where "esg_evaluation_items"."evaluation_item" is not null) as "evaluation_items_list" from "esg_evaluations" left join "esg_evaluation_items" on "esg_evaluations"."id" = "esg_evaluation_items"."esg_evaluation_id" AND "esg_evaluation_items"."is_active" = true left join "esg_answer_options" on "esg_evaluation_items"."id" = "esg_answer_options"."esg_evaluation_item_id" AND "esg_answer_options"."is_active" = true group by "esg_evaluations"."id", "esg_evaluations"."serial_number", "esg_evaluations"."category", "esg_evaluations"."inspection_item", "esg_evaluations"."is_active", "esg_evaluations"."created_at", "esg_evaluations"."updated_at");
\ No newline at end of file |
