added authentication among other things. considered working at this point.
This commit is contained in:
@@ -27,7 +27,11 @@ func InitDB(filepath string) *sql.DB {
|
||||
thunderball INTEGER
|
||||
);`
|
||||
|
||||
createMyTickets := `
|
||||
if _, err := db.Exec(createThunderballResultsTable); err != nil {
|
||||
log.Fatal("❌ Failed to create Thunderball table:", err)
|
||||
}
|
||||
|
||||
createMyTicketsTable := `
|
||||
CREATE TABLE IF NOT EXISTS my_tickets (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
game_type TEXT NOT NULL,
|
||||
@@ -43,12 +47,20 @@ func InitDB(filepath string) *sql.DB {
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);`
|
||||
|
||||
if _, err := db.Exec(createThunderballResultsTable); err != nil {
|
||||
log.Fatal("❌ Failed to create Thunderball table:", err)
|
||||
}
|
||||
if _, err := db.Exec(createMyTickets); err != nil {
|
||||
if _, err := db.Exec(createMyTicketsTable); err != nil {
|
||||
log.Fatal("❌ Failed to create MyTickets table:", err)
|
||||
}
|
||||
|
||||
createUsersTable := `
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
username TEXT NOT NULL UNIQUE,
|
||||
password_hash TEXT NOT NULL
|
||||
);`
|
||||
|
||||
if _, err := db.Exec(createUsersTable); err != nil {
|
||||
log.Fatal("❌ Failed to create Users table:", err)
|
||||
}
|
||||
|
||||
return db
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user