[][src]Module logins::schema

Logins Schema v4

The schema we use is a evolution of the firefox-ios logins database format. There are three tables:

loginsL

This stores local login information, also known as the "overlay".

loginsL is essentially unchanged from firefox-ios, however note the semantic change v4 makes to timestamp fields (which is explained in more detail in the [COMMON_COLS] documentation).

It is important to note that loginsL is not guaranteed to be present for all records. Synced records may only exist in loginsM (although this is not guaranteed). In either case, queries should read from both loginsL and loginsM.

loginsL Columns

Contains all fields in [COMMON_COLS], as well as the following additional columns:

loginsM

This stores server-side login information, also known as the "mirror".

Like loginsL, loginM has not changed from firefox-ios, beyond the change to store timestamps as milliseconds explained in [COMMON_COLS].

Also like loginsL, loginsM is not guaranteed to have rows for all records. It should not have rows for records which were not synced!

It is important to note that loginsL is not guaranteed to be present for all records. Synced records may only exist in loginsM! Queries should test against both!

loginsM Columns

Contains all fields in [COMMON_COLS], as well as the following additional columns:

loginsSyncMeta

This is a simple key-value table based on the moz_meta table in places. This table was added (by this rust crate) in version 4, and so is not present in firefox-ios.

Currently it is used to store two items:

  1. The last sync timestamp is stored under [LAST_SYNC_META_KEY], a sync15::ServerTimestamp stored in integer milliseconds.

  2. The persisted sync state machine information is stored under [GLOBAL_STATE_META_KEY]. This is a sync15::GlobalState stored as JSON.

Structs

CREATE_LOCAL_TABLE_SQL
CREATE_MIRROR_TABLE_SQL
SET_VERSION_SQL

Constants

COMMON_COLS

Every column shared by both tables except for id

COMMON_SQL
CREATE_DELETED_HOSTNAME_INDEX_SQL
CREATE_META_TABLE_SQL
CREATE_OVERRIDE_HOSTNAME_INDEX_SQL
UPDATE_LOCAL_TIMESTAMPS_TO_MILLIS_SQL
UPDATE_MIRROR_TIMESTAMPS_TO_MILLIS_SQL
VERSION

Note that firefox-ios is currently on version 3. Version 4 is this version, which adds a metadata table and changes timestamps to be in milliseconds

Statics

COLLECTION_SYNCID_META_KEY
GLOBAL_STATE_META_KEY
GLOBAL_SYNCID_META_KEY
LAST_SYNC_META_KEY

Functions

create
drop
init
upgrade