-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.sql
More file actions
34 lines (33 loc) · 1.57 KB
/
Copy pathdatabase.sql
File metadata and controls
34 lines (33 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
-- WARNING: This schema is for context only and is not meant to be run.
-- Table order and constraints may not be valid for execution.
CREATE TABLE public.transactions (
id uuid NOT NULL DEFAULT gen_random_uuid(),
sender_phone_number character varying NOT NULL,
receiver_phone_number character varying,
receiver_address character varying,
sender_address character varying NOT NULL,
amount numeric NOT NULL,
transaction_hash character varying UNIQUE,
status character varying DEFAULT 'pending'::character varying CHECK (status::text = ANY (ARRAY['pending'::character varying, 'completed'::character varying, 'failed'::character varying]::text[])),
error_message text,
gas_used bigint,
gas_price numeric,
created_at timestamp with time zone DEFAULT now(),
updated_at timestamp with time zone DEFAULT now(),
CONSTRAINT transactions_pkey PRIMARY KEY (id),
CONSTRAINT fk_sender_user FOREIGN KEY (sender_phone_number) REFERENCES public.users(phone_number),
CONSTRAINT fk_receiver_user FOREIGN KEY (receiver_phone_number) REFERENCES public.users(phone_number)
);
CREATE TABLE public.users (
id uuid NOT NULL DEFAULT gen_random_uuid(),
phone_number character varying NOT NULL UNIQUE,
starkkeypub character varying NOT NULL,
ozcontractaddress character varying NOT NULL,
isdeployed boolean DEFAULT false,
ozaccountconstructorcalldata text NOT NULL,
telegram_chat_id bigint,
notifications_enabled boolean DEFAULT true,
created_at timestamp with time zone DEFAULT now(),
updated_at timestamp with time zone DEFAULT now(),
CONSTRAINT users_pkey PRIMARY KEY (id)
);