create table "public"."code" (
    "id" uuid not null default gen_random_uuid(),
    "code" text not null
);


create table "public"."equipe-joueur" (
    "id_equipe" uuid not null default gen_random_uuid(),
    "id_joueur" uuid not null default gen_random_uuid()
);


create table "public"."flag" (
    "id_flag" uuid not null default gen_random_uuid(),
    "valeur_flag" text not null,
    "point" bigint not null,
    "predecesseur" text,
    "successeur" text
);


create table "public"."flag-trouve" (
    "id_flag" uuid not null default gen_random_uuid(),
    "id_equipe" uuid not null default gen_random_uuid()
);


create table "public"."indice" (
    "id_indice" uuid not null default gen_random_uuid(),
    "penalite" bigint not null,
    "text_indice" text not null
);


create table "public"."indice-equipe" (
    "id_equipe" uuid not null default gen_random_uuid(),
    "id_indice" uuid not null default gen_random_uuid()
);


create table "public"."joueur" (
    "uuid" uuid not null default auth.uid(),
    "created_at" timestamp with time zone not null default now(),
    "prenom" text not null,
    "pseudo" text not null
);


create table "public"."équipe" (
    "id_equipe" uuid not null default gen_random_uuid(),
    "created_at" timestamp with time zone not null default now(),
    "nom_equipe" text not null
);


CREATE UNIQUE INDEX code_pkey ON public.code USING btree (id);

CREATE UNIQUE INDEX "equipe-joueur_pkey" ON public."equipe-joueur" USING btree (id_equipe, id_joueur);

CREATE UNIQUE INDEX "flag-trouve_pkey" ON public."flag-trouve" USING btree (id_flag, id_equipe);

CREATE UNIQUE INDEX flag_pkey ON public.flag USING btree (id_flag);

CREATE UNIQUE INDEX "indice-equipe_pkey" ON public."indice-equipe" USING btree (id_equipe, id_indice);

CREATE UNIQUE INDEX indice_pkey ON public.indice USING btree (id_indice);

CREATE UNIQUE INDEX joueur_pkey ON public.joueur USING btree (uuid);

CREATE UNIQUE INDEX "équipe_pkey" ON public."équipe" USING btree (id_equipe);

alter table "public"."code" add constraint "code_pkey" PRIMARY KEY using index "code_pkey";

alter table "public"."equipe-joueur" add constraint "equipe-joueur_pkey" PRIMARY KEY using index "equipe-joueur_pkey";

alter table "public"."flag" add constraint "flag_pkey" PRIMARY KEY using index "flag_pkey";

alter table "public"."flag-trouve" add constraint "flag-trouve_pkey" PRIMARY KEY using index "flag-trouve_pkey";

alter table "public"."indice" add constraint "indice_pkey" PRIMARY KEY using index "indice_pkey";

alter table "public"."indice-equipe" add constraint "indice-equipe_pkey" PRIMARY KEY using index "indice-equipe_pkey";

alter table "public"."joueur" add constraint "joueur_pkey" PRIMARY KEY using index "joueur_pkey";

alter table "public"."équipe" add constraint "équipe_pkey" PRIMARY KEY using index "équipe_pkey";

alter table "public"."equipe-joueur" add constraint "equipe-joueur_id_equipe_fkey" FOREIGN KEY (id_equipe) REFERENCES "équipe"(id_equipe) not valid;

alter table "public"."equipe-joueur" validate constraint "equipe-joueur_id_equipe_fkey";

alter table "public"."equipe-joueur" add constraint "equipe-joueur_id_joueur_fkey" FOREIGN KEY (id_joueur) REFERENCES joueur(uuid) not valid;

alter table "public"."equipe-joueur" validate constraint "equipe-joueur_id_joueur_fkey";

alter table "public"."flag-trouve" add constraint "flag-trouve_id_equipe_fkey" FOREIGN KEY (id_equipe) REFERENCES "équipe"(id_equipe) not valid;

alter table "public"."flag-trouve" validate constraint "flag-trouve_id_equipe_fkey";

alter table "public"."flag-trouve" add constraint "flag-trouve_id_flag_fkey" FOREIGN KEY (id_flag) REFERENCES flag(id_flag) not valid;

alter table "public"."flag-trouve" validate constraint "flag-trouve_id_flag_fkey";

alter table "public"."indice-equipe" add constraint "indice-equipe_id_equipe_fkey" FOREIGN KEY (id_equipe) REFERENCES "équipe"(id_equipe) not valid;

alter table "public"."indice-equipe" validate constraint "indice-equipe_id_equipe_fkey";

alter table "public"."indice-equipe" add constraint "indice-equipe_id_indice_fkey" FOREIGN KEY (id_indice) REFERENCES indice(id_indice) not valid;

alter table "public"."indice-equipe" validate constraint "indice-equipe_id_indice_fkey";

grant delete on table "public"."code" to "anon";

grant insert on table "public"."code" to "anon";

grant references on table "public"."code" to "anon";

grant select on table "public"."code" to "anon";

grant trigger on table "public"."code" to "anon";

grant truncate on table "public"."code" to "anon";

grant update on table "public"."code" to "anon";

grant delete on table "public"."code" to "authenticated";

grant insert on table "public"."code" to "authenticated";

grant references on table "public"."code" to "authenticated";

grant select on table "public"."code" to "authenticated";

grant trigger on table "public"."code" to "authenticated";

grant truncate on table "public"."code" to "authenticated";

grant update on table "public"."code" to "authenticated";

grant delete on table "public"."code" to "service_role";

grant insert on table "public"."code" to "service_role";

grant references on table "public"."code" to "service_role";

grant select on table "public"."code" to "service_role";

grant trigger on table "public"."code" to "service_role";

grant truncate on table "public"."code" to "service_role";

grant update on table "public"."code" to "service_role";

grant delete on table "public"."equipe-joueur" to "anon";

grant insert on table "public"."equipe-joueur" to "anon";

grant references on table "public"."equipe-joueur" to "anon";

grant select on table "public"."equipe-joueur" to "anon";

grant trigger on table "public"."equipe-joueur" to "anon";

grant truncate on table "public"."equipe-joueur" to "anon";

grant update on table "public"."equipe-joueur" to "anon";

grant delete on table "public"."equipe-joueur" to "authenticated";

grant insert on table "public"."equipe-joueur" to "authenticated";

grant references on table "public"."equipe-joueur" to "authenticated";

grant select on table "public"."equipe-joueur" to "authenticated";

grant trigger on table "public"."equipe-joueur" to "authenticated";

grant truncate on table "public"."equipe-joueur" to "authenticated";

grant update on table "public"."equipe-joueur" to "authenticated";

grant delete on table "public"."equipe-joueur" to "service_role";

grant insert on table "public"."equipe-joueur" to "service_role";

grant references on table "public"."equipe-joueur" to "service_role";

grant select on table "public"."equipe-joueur" to "service_role";

grant trigger on table "public"."equipe-joueur" to "service_role";

grant truncate on table "public"."equipe-joueur" to "service_role";

grant update on table "public"."equipe-joueur" to "service_role";

grant delete on table "public"."flag" to "anon";

grant insert on table "public"."flag" to "anon";

grant references on table "public"."flag" to "anon";

grant select on table "public"."flag" to "anon";

grant trigger on table "public"."flag" to "anon";

grant truncate on table "public"."flag" to "anon";

grant update on table "public"."flag" to "anon";

grant delete on table "public"."flag" to "authenticated";

grant insert on table "public"."flag" to "authenticated";

grant references on table "public"."flag" to "authenticated";

grant select on table "public"."flag" to "authenticated";

grant trigger on table "public"."flag" to "authenticated";

grant truncate on table "public"."flag" to "authenticated";

grant update on table "public"."flag" to "authenticated";

grant delete on table "public"."flag" to "service_role";

grant insert on table "public"."flag" to "service_role";

grant references on table "public"."flag" to "service_role";

grant select on table "public"."flag" to "service_role";

grant trigger on table "public"."flag" to "service_role";

grant truncate on table "public"."flag" to "service_role";

grant update on table "public"."flag" to "service_role";

grant delete on table "public"."flag-trouve" to "anon";

grant insert on table "public"."flag-trouve" to "anon";

grant references on table "public"."flag-trouve" to "anon";

grant select on table "public"."flag-trouve" to "anon";

grant trigger on table "public"."flag-trouve" to "anon";

grant truncate on table "public"."flag-trouve" to "anon";

grant update on table "public"."flag-trouve" to "anon";

grant delete on table "public"."flag-trouve" to "authenticated";

grant insert on table "public"."flag-trouve" to "authenticated";

grant references on table "public"."flag-trouve" to "authenticated";

grant select on table "public"."flag-trouve" to "authenticated";

grant trigger on table "public"."flag-trouve" to "authenticated";

grant truncate on table "public"."flag-trouve" to "authenticated";

grant update on table "public"."flag-trouve" to "authenticated";

grant delete on table "public"."flag-trouve" to "service_role";

grant insert on table "public"."flag-trouve" to "service_role";

grant references on table "public"."flag-trouve" to "service_role";

grant select on table "public"."flag-trouve" to "service_role";

grant trigger on table "public"."flag-trouve" to "service_role";

grant truncate on table "public"."flag-trouve" to "service_role";

grant update on table "public"."flag-trouve" to "service_role";

grant delete on table "public"."indice" to "anon";

grant insert on table "public"."indice" to "anon";

grant references on table "public"."indice" to "anon";

grant select on table "public"."indice" to "anon";

grant trigger on table "public"."indice" to "anon";

grant truncate on table "public"."indice" to "anon";

grant update on table "public"."indice" to "anon";

grant delete on table "public"."indice" to "authenticated";

grant insert on table "public"."indice" to "authenticated";

grant references on table "public"."indice" to "authenticated";

grant select on table "public"."indice" to "authenticated";

grant trigger on table "public"."indice" to "authenticated";

grant truncate on table "public"."indice" to "authenticated";

grant update on table "public"."indice" to "authenticated";

grant delete on table "public"."indice" to "service_role";

grant insert on table "public"."indice" to "service_role";

grant references on table "public"."indice" to "service_role";

grant select on table "public"."indice" to "service_role";

grant trigger on table "public"."indice" to "service_role";

grant truncate on table "public"."indice" to "service_role";

grant update on table "public"."indice" to "service_role";

grant delete on table "public"."indice-equipe" to "anon";

grant insert on table "public"."indice-equipe" to "anon";

grant references on table "public"."indice-equipe" to "anon";

grant select on table "public"."indice-equipe" to "anon";

grant trigger on table "public"."indice-equipe" to "anon";

grant truncate on table "public"."indice-equipe" to "anon";

grant update on table "public"."indice-equipe" to "anon";

grant delete on table "public"."indice-equipe" to "authenticated";

grant insert on table "public"."indice-equipe" to "authenticated";

grant references on table "public"."indice-equipe" to "authenticated";

grant select on table "public"."indice-equipe" to "authenticated";

grant trigger on table "public"."indice-equipe" to "authenticated";

grant truncate on table "public"."indice-equipe" to "authenticated";

grant update on table "public"."indice-equipe" to "authenticated";

grant delete on table "public"."indice-equipe" to "service_role";

grant insert on table "public"."indice-equipe" to "service_role";

grant references on table "public"."indice-equipe" to "service_role";

grant select on table "public"."indice-equipe" to "service_role";

grant trigger on table "public"."indice-equipe" to "service_role";

grant truncate on table "public"."indice-equipe" to "service_role";

grant update on table "public"."indice-equipe" to "service_role";

grant delete on table "public"."joueur" to "anon";

grant insert on table "public"."joueur" to "anon";

grant references on table "public"."joueur" to "anon";

grant select on table "public"."joueur" to "anon";

grant trigger on table "public"."joueur" to "anon";

grant truncate on table "public"."joueur" to "anon";

grant update on table "public"."joueur" to "anon";

grant delete on table "public"."joueur" to "authenticated";

grant insert on table "public"."joueur" to "authenticated";

grant references on table "public"."joueur" to "authenticated";

grant select on table "public"."joueur" to "authenticated";

grant trigger on table "public"."joueur" to "authenticated";

grant truncate on table "public"."joueur" to "authenticated";

grant update on table "public"."joueur" to "authenticated";

grant delete on table "public"."joueur" to "service_role";

grant insert on table "public"."joueur" to "service_role";

grant references on table "public"."joueur" to "service_role";

grant select on table "public"."joueur" to "service_role";

grant trigger on table "public"."joueur" to "service_role";

grant truncate on table "public"."joueur" to "service_role";

grant update on table "public"."joueur" to "service_role";

grant delete on table "public"."équipe" to "anon";

grant insert on table "public"."équipe" to "anon";

grant references on table "public"."équipe" to "anon";

grant select on table "public"."équipe" to "anon";

grant trigger on table "public"."équipe" to "anon";

grant truncate on table "public"."équipe" to "anon";

grant update on table "public"."équipe" to "anon";

grant delete on table "public"."équipe" to "authenticated";

grant insert on table "public"."équipe" to "authenticated";

grant references on table "public"."équipe" to "authenticated";

grant select on table "public"."équipe" to "authenticated";

grant trigger on table "public"."équipe" to "authenticated";

grant truncate on table "public"."équipe" to "authenticated";

grant update on table "public"."équipe" to "authenticated";

grant delete on table "public"."équipe" to "service_role";

grant insert on table "public"."équipe" to "service_role";

grant references on table "public"."équipe" to "service_role";

grant select on table "public"."équipe" to "service_role";

grant trigger on table "public"."équipe" to "service_role";

grant truncate on table "public"."équipe" to "service_role";

grant update on table "public"."équipe" to "service_role";


