summaryrefslogtreecommitdiffstats
path: root/crates/auth-service/migrations/20250723100947_user.sql
diff options
context:
space:
mode:
Diffstat (limited to 'crates/auth-service/migrations/20250723100947_user.sql')
-rw-r--r--crates/auth-service/migrations/20250723100947_user.sql20
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/auth-service/migrations/20250723100947_user.sql b/crates/auth-service/migrations/20250723100947_user.sql
new file mode 100644
index 0000000..b5566fe
--- /dev/null
+++ b/crates/auth-service/migrations/20250723100947_user.sql
@@ -0,0 +1,20 @@
+-- Add migration script here
+create table auth_user (
+ id uuid primary key,
+ email text unique not null,
+ updated_at timestamptz not null default now(),
+ created_at timestamptz not null default now()
+);
+
+create or replace function set_updated_at()
+returns trigger as $$
+begin
+ new.updated_at := now();
+ return new;
+end;
+$$ language plpgsql;
+
+create trigger trigger_set_updated_at
+before update on auth_user
+for each row
+execute function set_updated_at();