Skip to content

Commit

Permalink
db: initial schema migration
Browse files Browse the repository at this point in the history
  • Loading branch information
gaboesquivel committed Jan 29, 2024
1 parent f2d48a7 commit d10e4b2
Show file tree
Hide file tree
Showing 3 changed files with 195 additions and 0 deletions.
Empty file.
195 changes: 195 additions & 0 deletions apps/supabase/migrations/20240129074946_initial_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
create table "public"."auction_details" (
"id" bigint generated by default as identity not null,
"created_at" timestamp with time zone not null default now(),
"exact_order_id" bigint,
"chain_id" text,
"symbol_auctioning_token" text,
"symbol_bidding_token" text,
"address_auctioning_token" text,
"address_bidding_token" text,
"decimals_auctioning_token" smallint,
"decimals_bidding_token" smallint,
"end_time_timestamp" timestamp without time zone,
"order_cancellation_end_date" timestamp without time zone,
"starting_time_stamp" timestamp without time zone,
"minimum_bidding_amount_per_order" bigint,
"min_funding_threshold" bigint,
"allow_list_manager" text,
"allow_list_signer" text,
"current_volume" integer,
"current_clearing_order_sell_amount" bigint,
"current_clearing_order_buy_amount" bigint,
"current_clearing_price" integer,
"current_bidding_amount" bigint,
"is_atomic_closure_allowed" boolean,
"is_private_auction" boolean,
"interest_score" integer,
"usd_amount_traded" integer
);


alter table "public"."auction_details" enable row level security;

create table "public"."orders" (
"id" bigint generated by default as identity not null,
"created_at" timestamp with time zone not null default now(),
"auction_id" bigint,
"sell_amount" bigint,
"buy_amount" bigint,
"user_id" bigint,
"price" integer,
"volume" bigint,
"timestamp" timestamp without time zone
);


alter table "public"."orders" enable row level security;

create table "public"."users" (
"id" bigint generated by default as identity not null,
"created_at" timestamp with time zone not null default now(),
"address" text not null
);


alter table "public"."users" enable row level security;

CREATE UNIQUE INDEX auction_details_pkey ON public.auction_details USING btree (id);

CREATE UNIQUE INDEX orders_pkey ON public.orders USING btree (id);

CREATE UNIQUE INDEX users_pkey ON public.users USING btree (id, created_at);

alter table "public"."auction_details" add constraint "auction_details_pkey" PRIMARY KEY using index "auction_details_pkey";

alter table "public"."orders" add constraint "orders_pkey" PRIMARY KEY using index "orders_pkey";

alter table "public"."users" add constraint "users_pkey" PRIMARY KEY using index "users_pkey";

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


Empty file.

0 comments on commit d10e4b2

Please sign in to comment.