create schema if not exists "app";

create table "app"."accounts" (
    "uid" bigint generated always as identity not null,
    "id" uuid not null
);


CREATE UNIQUE INDEX accounts_id_key ON app.accounts USING btree (id);

CREATE UNIQUE INDEX accounts_pkey ON app.accounts USING btree (uid);

alter table "app"."accounts" add constraint "accounts_pkey" PRIMARY KEY using index "accounts_pkey";

alter table "app"."accounts" add constraint "accounts_id_key" UNIQUE using index "accounts_id_key";

alter table "app"."accounts" add constraint "fk_user" FOREIGN KEY (id) REFERENCES auth.users(id) ON DELETE CASCADE not valid;

alter table "app"."accounts" validate constraint "fk_user";


