From d1f0f7a1641b206ef32293ad8a94cbcc0ff256d1 Mon Sep 17 00:00:00 2001 From: "Outrun Colors, LLC" Date: Sun, 29 May 2022 01:18:16 -0500 Subject: [PATCH] Add foreignkey --- files/classes/lottery.py | 1 + files/templates/lottery_modal.html | 9 --------- lottery.sql | 30 ------------------------------ 3 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 lottery.sql diff --git a/files/classes/lottery.py b/files/classes/lottery.py index 560b51f5a0..35d1632789 100644 --- a/files/classes/lottery.py +++ b/files/classes/lottery.py @@ -13,6 +13,7 @@ class Lottery(Base): ends_at = Column(Integer) prize = Column(Integer, default=0) tickets_sold = Column(Integer, default=0) + winner_id = Column(Integer, ForeignKey("users.id")) @property @lazy diff --git a/files/templates/lottery_modal.html b/files/templates/lottery_modal.html index 745e3284e8..96b0afbd99 100644 --- a/files/templates/lottery_modal.html +++ b/files/templates/lottery_modal.html @@ -122,15 +122,6 @@ 12 - diff --git a/lottery.sql b/lottery.sql deleted file mode 100644 index 3d4ab86187..0000000000 --- a/lottery.sql +++ /dev/null @@ -1,30 +0,0 @@ -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; \ No newline at end of file