From 7dc43ddd6ff667b8b5bd3fefafbd585a7cc1b88b Mon Sep 17 00:00:00 2001 From: Gent Semaj Date: Tue, 26 Nov 2024 21:21:35 -0500 Subject: [PATCH] Add LastPasswordReset timestamp column, missing DB version bump --- sql/migration5.sql | 6 +++++- sql/tables.sql | 23 ++++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/sql/migration5.sql b/sql/migration5.sql index ba5dc89..5b557ee 100644 --- a/sql/migration5.sql +++ b/sql/migration5.sql @@ -1,4 +1,8 @@ BEGIN TRANSACTION; --- New Column +-- New Columns ALTER TABLE Accounts ADD Email TEXT DEFAULT '' NOT NULL; +ALTER TABLE Accounts ADD LastPasswordReset INTEGER DEFAULT 0 NOT NULL; +-- Update DB Version +UPDATE Meta SET Value = 6 WHERE Key = 'DatabaseVersion'; +UPDATE Meta SET Value = strftime('%s', 'now') WHERE Key = 'LastMigration'; COMMIT; diff --git a/sql/tables.sql b/sql/tables.sql index 490656a..11e1650 100644 --- a/sql/tables.sql +++ b/sql/tables.sql @@ -1,15 +1,16 @@ CREATE TABLE IF NOT EXISTS Accounts ( - AccountID INTEGER NOT NULL, - Login TEXT NOT NULL UNIQUE COLLATE NOCASE, - Password TEXT NOT NULL, - Selected INTEGER DEFAULT 1 NOT NULL, - AccountLevel INTEGER NOT NULL, - Created INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL, - LastLogin INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL, - BannedUntil INTEGER DEFAULT 0 NOT NULL, - BannedSince INTEGER DEFAULT 0 NOT NULL, - BanReason TEXT DEFAULT '' NOT NULL, - Email TEXT DEFAULT '' NOT NULL, + AccountID INTEGER NOT NULL, + Login TEXT NOT NULL UNIQUE COLLATE NOCASE, + Password TEXT NOT NULL, + Selected INTEGER DEFAULT 1 NOT NULL, + AccountLevel INTEGER NOT NULL, + Created INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL, + LastLogin INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL, + BannedUntil INTEGER DEFAULT 0 NOT NULL, + BannedSince INTEGER DEFAULT 0 NOT NULL, + BanReason TEXT DEFAULT '' NOT NULL, + Email TEXT DEFAULT '' NOT NULL, + LastPasswordReset INTEGER DEFAULT 0 NOT NULL, PRIMARY KEY(AccountID AUTOINCREMENT) );