feat(database): regenerated the sql code and fixed autoincrement on text column

This commit is contained in:
Maieul BOYER 2025-10-02 01:41:47 +02:00 committed by Maix0
parent 8e4081f494
commit bca385adc9
2 changed files with 5 additions and 4 deletions

View file

@ -16,7 +16,7 @@ Project Transcendance {
} }
Table user { Table user {
id integer [PK, not null, increment] id text [PK, not null]
name text [unique, not null] name text [unique, not null]
password text [null, Note: "If password is NULL, this means that the user is created through OAUTH2"] password text [null, Note: "If password is NULL, this means that the user is created through OAUTH2"]
otp text [null, Note: "If otp is NULL, then the user didn't configure 2FA"] otp text [null, Note: "If otp is NULL, then the user didn't configure 2FA"]

View file

@ -1,13 +1,14 @@
CREATE TABLE IF NOT EXISTS user ( CREATE TABLE IF NOT EXISTS user (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id TEXT PRIMARY KEY NOT NULL,
name TEXT NOT NULL UNIQUE, name TEXT NOT NULL UNIQUE,
password TEXT, password TEXT,
otp TEXT otp TEXT,
guest INTEGER NOT NULL DEFAULT 0
); );
CREATE TABLE IF NOT EXISTS auth ( CREATE TABLE IF NOT EXISTS auth (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
provider TEXT NOT NULL, provider TEXT NOT NULL,
user INTEGER NOT NULL, user TEXT NOT NULL,
oauth2_user TEXT NOT NULL UNIQUE, oauth2_user TEXT NOT NULL UNIQUE,
FOREIGN KEY(user) REFERENCES user(id) FOREIGN KEY(user) REFERENCES user(id)
); );