mirror of
https://github.com/lifegpc/pixiv_downloader.git
synced 2026-06-06 05:49:01 +08:00
add is_admin
This commit is contained in:
@@ -4,3 +4,4 @@
|
||||
| name | Name of user | string |
|
||||
| username | Username of user (unique) | string |
|
||||
| password | Password of user | string |
|
||||
| is_admin | Whether user is admin | boolean |
|
||||
|
||||
@@ -63,6 +63,7 @@ id INT,
|
||||
name TEXT,
|
||||
username TEXT,
|
||||
password TEXT,
|
||||
is_admin BOOLEAN,
|
||||
PRIMARY KEY (id)
|
||||
);";
|
||||
const VERSION_TABLE: &'static str = "CREATE TABLE version (
|
||||
@@ -73,7 +74,7 @@ v3 INT,
|
||||
v4 INT,
|
||||
PRIMARY KEY (id)
|
||||
);";
|
||||
const VERSION: [u8; 4] = [1, 0, 0, 1];
|
||||
const VERSION: [u8; 4] = [1, 0, 0, 2];
|
||||
|
||||
pub struct PixivDownloaderSqlite {
|
||||
db: Mutex<Connection>,
|
||||
@@ -105,6 +106,9 @@ impl PixivDownloaderSqlite {
|
||||
tx.execute(TOKEN_TABLE, [])?;
|
||||
tx.execute(USERS_TABLE, [])?;
|
||||
}
|
||||
if db_version < [1, 0, 0, 2] {
|
||||
tx.execute("ALTER TABLE users ADD is_admin BOOLEAN;", [])?;
|
||||
}
|
||||
self._write_version(&tx)?;
|
||||
tx.commit()?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user