forked from rDrama/rDrama
1
0
Fork 0
rDrama/lottery.sql

30 lines
800 B
SQL

CREATE TABLE public.lotteries (
id SERIAL PRIMARY KEY,
is_active boolean DEFAULT false NOT NULL,
ends_at integer NOT NULL,
prize integer DEFAULT 0 NOT NULL,
tickets_sold integer DEFAULT 0 NOT NULL
);
--
-- Name: lotteries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.lotteries_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: lotteries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.lotteries_id_seq OWNED BY public.lotteries.id;
ALTER TABLE public.users
ADD currently_held_lottery_tickets integer DEFAULT 0 NOT NULL,
ADD total_held_lottery_tickets integer DEFAULT 0 NOT NULL,
ADD total_lottery_winnings integer DEFAULT 0 NOT NULL;