mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-23 05:40:08 +00:00
2eb64540d1
This fixes a UX issue, where if you accidentally capitalized a letter in the username when logging in, it would instead create a new account. The behavior was confusing, since to the user it looks as if their characters were deleted or progress was not saved. In order for this to work, duplicate accounts (e.g. username and USERNAME) need to be deleted/renamed. The server will *detect* if any duplicates exist. If any are found, it will direct the server operator to a pruning script, or they can choose to resolve the duplicates manually.
29 lines
1.0 KiB
SQL
29 lines
1.0 KiB
SQL
/*
|
|
It is recommended in the SQLite manual to turn off
|
|
foreign keys when making schema changes that involve them
|
|
*/
|
|
PRAGMA foreign_keys=OFF;
|
|
BEGIN TRANSACTION;
|
|
-- Change username column (Login) to be case-insensitive
|
|
CREATE TABLE Temp (
|
|
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,
|
|
PRIMARY KEY(AccountID AUTOINCREMENT)
|
|
);
|
|
INSERT INTO Temp SELECT * FROM Accounts;
|
|
DROP TABLE Accounts;
|
|
ALTER TABLE Temp RENAME TO Accounts;
|
|
-- Update DB Version
|
|
UPDATE Meta SET Value = 4 WHERE Key = 'DatabaseVersion';
|
|
UPDATE Meta SET Value = strftime('%s', 'now') WHERE Key = 'LastMigration';
|
|
COMMIT;
|
|
PRAGMA foreign_keys=ON;
|