forked from rDrama/rDrama
1
0
Fork 0

Add foreignkey

master
Outrun Colors, LLC 2022-05-29 01:18:16 -05:00
parent 562202b38d
commit d1f0f7a164
3 changed files with 1 additions and 39 deletions

View File

@ -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

View File

@ -122,15 +122,6 @@
12
</button>
<script>
const userCoinCount = {{v.coins}};
const ticketCost = 12;
if (userCoinCount < ticketCost) {
const purchaseTicketButton = document.getElementById('purchaseTicket');
purchaseTicketButton.disabled = true;
}
</script>
</div>
</div>
</div>

View File

@ -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;