version 1.1.2.1, 2011/11/23 00:47:50
|
version 1.1.2.3, 2011/11/28 15:22:25
|
Line 1
|
Line 1
|
PRAGMA foreign_keys=ON; |
PRAGMA foreign_keys=ON; |
BEGIN TRANSACTION; |
BEGIN TRANSACTION; |
CREATE TABLE Users ( | CREATE TABLE IF NOT EXISTS Users ( |
uid integer primary key AUTOINCREMENT, |
uid integer primary key AUTOINCREMENT, |
Username varchar(64) not null, |
Username varchar(64) not null, |
Password varchar(64) not null, |
Password varchar(64) not null, |
Access integer not null, |
Access integer not null, |
Stamp timestamp); |
Stamp timestamp); |
CREATE UNIQUE INDEX User on Users (UserName); | CREATE UNIQUE INDEX IF NOT EXISTS User on Users (UserName); |
| CREATE TRIGGER IF NOT EXISTS Users_update_t AFTER UPDATE ON Users |
| BEGIN |
| UPDATE Users SET Stamp = strftime("%s", "now") WHERE Username = old.Username; |
| END; |
| CREATE TRIGGER IF NOT EXISTS Users_insert_t AFTER INSERT ON Users |
| BEGIN |
| UPDATE Users SET Stamp = strftime("%s", "now") WHERE Username = new.Username; |
| END; |
COMMIT; |
COMMIT; |