summaryrefslogtreecommitdiffstats
path: root/crates/auth/migrations/20250723100947_user.sql
blob: b5566fe7306312d883d1b4825200c4fe05c0dec7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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();