From 1a2241c40e10193c5ff7008a7b7b36cc1d855d96 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Tue, 25 Mar 2025 15:55:45 +0900
Subject: initial commit

---
 db/migrations/0003_unknown_speed_demon.sql | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 db/migrations/0003_unknown_speed_demon.sql

(limited to 'db/migrations/0003_unknown_speed_demon.sql')

diff --git a/db/migrations/0003_unknown_speed_demon.sql b/db/migrations/0003_unknown_speed_demon.sql
new file mode 100644
index 00000000..19fc36a8
--- /dev/null
+++ b/db/migrations/0003_unknown_speed_demon.sql
@@ -0,0 +1,5 @@
+DROP VIEW "public"."user_view";--> statement-breakpoint
+ALTER TABLE "roles" ADD COLUMN "description" text DEFAULT '' NOT NULL;--> statement-breakpoint
+CREATE VIEW "public"."user_view" AS (select "users"."id" as "user_id", "users"."name" as "user_name", "users"."email" as "user_email", "users"."domain" as "user_domain", "users"."image_url" as "user_image", "companies"."id" as "company_id", "companies"."name" as "company_name", 
+      array_agg("roles"."name")
+     as "roles", "users"."created_at" as "created_at" from "users" left join "companies" on "users"."company_id" = "companies"."id" left join "user_roles" on "users"."id" = "user_roles"."user_id" left join "roles" on "user_roles"."role_id" = "roles"."id" group by "users"."id", "companies"."id");
\ No newline at end of file
-- 
cgit v1.2.3

