Schema:
CREATE TABLE r.Events (eventid INTEGER PRIMARY KEY AUTOINCREMENT, eventdate TEXT, rewards TEXT );
CREATE TABLE r.Users (ticketid INTEGER PRIMARY KEY, name TEXT);
CREATE TABLE r.TICKETS (ticketid INTEGER PRIMARY KEY, used boolean, FOREIGN KEY(ticketid) REFERENCES USERS (ticketid));
CREATE TABLE r.Participate (userid INTEGER, eventid INTEGER, PRIMARY KEY(userid, eventid));
CREATE TABLE r.Winner (EventDate TEXT, Name TEXT, Rewards TEXT, PRIMARY KEY(EventDate), FOREIGN KEY(NAME) REFERENCES Users (Name), FOREIGN KEY(Rewards) REFERENCES Events (Rewards) );
STEPS: open terminal
- virtualenv env
- source env/bin/activate
- pip3 install -r requirements.txt
- export FLASK_APP = raffler.py
- flask run
To view contents of a table: open terminal
- install sqlite3
- sqlite3
- ATTACH 'raffle.db' as r;
- .tables
- SELECT * FROM 'TABLE_NAME';
- .schema