ickerio / cits3403

0 stars 1 forks source link

SQL Schema #19

Closed ickerio closed 4 months ago

ickerio commented 4 months ago
CREATE TABLE users(
    username CHAR(64) PRIMARY KEY,
    first_name CHAR(32) NOT NULL,
    last_name CHAR(32) NOT NULL,
);

CREATE TABLE sketches(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    username CHAR(64) NOT NULL,
    content BLOB NOT NULL,
    FOREIGN KEY(username) REFERENCES user(username)
);

CREATE TABLE sketch_guesses(
    sketch_id INTEGER NOT NULL REFERENCES sketch(id),
    username CHAR(64) NOT NULL REFERENCES user(username),
    points INTEGER NOT NULL,
);
ickerio commented 4 months ago

add auth sessions using cookies and UUID v4. expiry is unix epoch time

CREATE TABLE sessions(
    id CHAR(36) PRIMARY KEY,
    username CHAR(64) NOT NULL REFERENCES user(username),
    expiry INTEGER NOT NULL,
)
HenriScaff commented 4 months ago

https://github.com/ickerio/cits3403/commit/e89ae11f73b1063b935f3fe6e3eb640a0a4a36c9

Added models to reflect the above with minor alterations in branch 'add-models'. Didn't include auth.

ickerio commented 4 months ago

Will be using Flask-Login which I assume uses memory for handling sessions rather than SQL as instructed on the forums https://flask-login.readthedocs.io/en/latest/