-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path20200815134218_create_sponsor.up.sql
25 lines (25 loc) · 1.12 KB
/
20200815134218_create_sponsor.up.sql
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
create or replace function increment(i integer) returns integer as
$$
begin
return i + 1; -- operators
end;
$$ language plpgsql;
-- Constants Dollar-Quoted String Constants
create function add(integer, integer) returns integer as
$$
begin
return $1 + $2; -- position parameters
end;
$$ language plpgsql;
create table if not exists sponsor
(
id uuid not null primary key default gen_random_uuid(),
serial_number varchar(255) not null default ''::varchar, -- type case
project_id uuid not null,
amount real not null default 0, --float
fee int8 not null default 0, --bigint
sponsor_time timestamp with time zone not null default current_timestamp,
create_time timestamp with time zone not null default current_timestamp,
misc jsonb not null default '{}'::jsonb
);
create unique index if not exists sponsor_serial_number_index on sponsor using btree (serial_number);