Restore id
This commit is contained in:
@@ -86,6 +86,7 @@ CREATE TABLE app_names (id INTEGER PRIMARY KEY, name TEXT NOT NULL UNIQUE);
|
|||||||
|
|
||||||
-- Main table with foreign keys and millisecond timestamp
|
-- Main table with foreign keys and millisecond timestamp
|
||||||
CREATE TABLE signature_entries (
|
CREATE TABLE signature_entries (
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
session_id TEXT NOT NULL,
|
session_id TEXT NOT NULL,
|
||||||
timestamp_ms INTEGER NOT NULL, -- Unix epoch milliseconds
|
timestamp_ms INTEGER NOT NULL, -- Unix epoch milliseconds
|
||||||
app_id INTEGER NOT NULL REFERENCES apps(id),
|
app_id INTEGER NOT NULL REFERENCES apps(id),
|
||||||
@@ -99,11 +100,11 @@ CREATE TABLE signature_entries (
|
|||||||
is_offline_login_enabled INTEGER,
|
is_offline_login_enabled INTEGER,
|
||||||
model_id INTEGER REFERENCES models(id),
|
model_id INTEGER REFERENCES models(id),
|
||||||
device_id INTEGER REFERENCES devices(id),
|
device_id INTEGER REFERENCES devices(id),
|
||||||
password_autofill_usage INTEGER,
|
password_autofill_usage INTEGER
|
||||||
PRIMARY KEY (session_id, timestamp_ms)
|
);
|
||||||
) WITHOUT ROWID;
|
|
||||||
|
|
||||||
CREATE INDEX idx_session_id ON signature_entries(session_id);
|
CREATE INDEX idx_session_id ON signature_entries(session_id);
|
||||||
|
CREATE INDEX idx_timestamp ON signature_entries(timestamp_ms);
|
||||||
CREATE INDEX idx_version ON signature_entries(version_id);
|
CREATE INDEX idx_version ON signature_entries(version_id);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
12
src/db.rs
12
src/db.rs
@@ -55,8 +55,8 @@ impl Database {
|
|||||||
);
|
);
|
||||||
|
|
||||||
-- Main table with normalized foreign keys and integer timestamp
|
-- Main table with normalized foreign keys and integer timestamp
|
||||||
-- timestamp_ms stores milliseconds since epoch for uniqueness
|
|
||||||
CREATE TABLE IF NOT EXISTS signature_entries (
|
CREATE TABLE IF NOT EXISTS signature_entries (
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
session_id TEXT NOT NULL,
|
session_id TEXT NOT NULL,
|
||||||
timestamp_ms INTEGER NOT NULL,
|
timestamp_ms INTEGER NOT NULL,
|
||||||
app_id INTEGER NOT NULL REFERENCES apps(id),
|
app_id INTEGER NOT NULL REFERENCES apps(id),
|
||||||
@@ -70,11 +70,11 @@ impl Database {
|
|||||||
is_offline_login_enabled INTEGER,
|
is_offline_login_enabled INTEGER,
|
||||||
model_id INTEGER REFERENCES models(id),
|
model_id INTEGER REFERENCES models(id),
|
||||||
device_id INTEGER REFERENCES devices(id),
|
device_id INTEGER REFERENCES devices(id),
|
||||||
password_autofill_usage INTEGER,
|
password_autofill_usage INTEGER
|
||||||
PRIMARY KEY (session_id, timestamp_ms)
|
);
|
||||||
) WITHOUT ROWID;
|
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_session_id ON signature_entries(session_id);
|
CREATE INDEX IF NOT EXISTS idx_session_id ON signature_entries(session_id);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_timestamp ON signature_entries(timestamp_ms);
|
||||||
CREATE INDEX IF NOT EXISTS idx_version ON signature_entries(version_id);
|
CREATE INDEX IF NOT EXISTS idx_version ON signature_entries(version_id);
|
||||||
"#,
|
"#,
|
||||||
)?;
|
)?;
|
||||||
@@ -97,11 +97,11 @@ impl Database {
|
|||||||
let mut insert_stmt = tx.prepare_cached(
|
let mut insert_stmt = tx.prepare_cached(
|
||||||
r#"
|
r#"
|
||||||
INSERT INTO signature_entries (
|
INSERT INTO signature_entries (
|
||||||
session_id, timestamp_ms, app_id, version_id,
|
id, session_id, timestamp_ms, app_id, version_id,
|
||||||
offline_login_usage, is_password_autofill_enabled, camera_roll_usage,
|
offline_login_usage, is_password_autofill_enabled, camera_roll_usage,
|
||||||
os_id, app_name_id, touch_id, is_offline_login_enabled,
|
os_id, app_name_id, touch_id, is_offline_login_enabled,
|
||||||
model_id, device_id, password_autofill_usage
|
model_id, device_id, password_autofill_usage
|
||||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
) VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
"#,
|
"#,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user