Skip to content

Commit 36e0667

Browse files
Add Email and LastPasswordReset columns to Account table (#299)
* Add Email column to Account table * Add LastPasswordReset timestamp column, missing DB version bump
1 parent ed9fe61 commit 36e0667

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

sql/migration5.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
BEGIN TRANSACTION;
2+
-- New Columns
3+
ALTER TABLE Accounts ADD Email TEXT DEFAULT '' NOT NULL;
4+
ALTER TABLE Accounts ADD LastPasswordReset INTEGER DEFAULT 0 NOT NULL;
5+
-- Update DB Version
6+
UPDATE Meta SET Value = 6 WHERE Key = 'DatabaseVersion';
7+
UPDATE Meta SET Value = strftime('%s', 'now') WHERE Key = 'LastMigration';
8+
COMMIT;

sql/tables.sql

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
CREATE TABLE IF NOT EXISTS Accounts (
2-
AccountID INTEGER NOT NULL,
3-
Login TEXT NOT NULL UNIQUE COLLATE NOCASE,
4-
Password TEXT NOT NULL,
5-
Selected INTEGER DEFAULT 1 NOT NULL,
6-
AccountLevel INTEGER NOT NULL,
7-
Created INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL,
8-
LastLogin INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL,
9-
BannedUntil INTEGER DEFAULT 0 NOT NULL,
10-
BannedSince INTEGER DEFAULT 0 NOT NULL,
11-
BanReason TEXT DEFAULT '' NOT NULL,
2+
AccountID INTEGER NOT NULL,
3+
Login TEXT NOT NULL UNIQUE COLLATE NOCASE,
4+
Password TEXT NOT NULL,
5+
Selected INTEGER DEFAULT 1 NOT NULL,
6+
AccountLevel INTEGER NOT NULL,
7+
Created INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL,
8+
LastLogin INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL,
9+
BannedUntil INTEGER DEFAULT 0 NOT NULL,
10+
BannedSince INTEGER DEFAULT 0 NOT NULL,
11+
BanReason TEXT DEFAULT '' NOT NULL,
12+
Email TEXT DEFAULT '' NOT NULL,
13+
LastPasswordReset INTEGER DEFAULT 0 NOT NULL,
1214
PRIMARY KEY(AccountID AUTOINCREMENT)
1315
);
1416

src/db/Database.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <string>
66
#include <vector>
77

8-
#define DATABASE_VERSION 5
8+
#define DATABASE_VERSION 6
99

1010
namespace Database {
1111

0 commit comments

Comments
 (0)