CREATE TABLE accounts (
	contact_info_alias TEXT,
	contact_info_color TEXT,
	contact_info_email TEXT,
	contact_info_external INTEGER DEFAULT 0,
	contact_info_favorite INTEGER DEFAULT 0,
	contact_info_id TEXT,
	contact_info_note TEXT,
	contact_info_phone_number TEXT,
	contact_info_sid TEXT,
	contact_info_time_zone TEXT,
	enabled INTEGER DEFAULT 0,
	error BLOB,
	id TEXT NOT NULL,
	name TEXT NOT NULL,
	protocol_id TEXT,
	remember_password INTEGER DEFAULT 0,
	require_password INTEGER DEFAULT 0,
	user_info TEXT,

	-- We don't track the presence as that will always be updated to the
	-- current status in purple.

	PRIMARY KEY(id)
) STRICT;

CREATE TABLE account_settings (
	account_id TEXT NOT NULL,
	id TEXT NOT NULL,
	type TEXT NOT NULL,
	value TEXT,

	PRIMARY KEY(account_id, id)
) STRICT;

CREATE TABLE account_contact_info_badges (
	account_id TEXT NOT NULL,
	badge_id TEXT NOT NULL,

	PRIMARY KEY (account_id, badge_id)
) STRICT;

CREATE TABLE account_contact_info_tags (
	account_id TEXT NOT NULL,
	tag TEXT NOT NULL,

	PRIMARY KEY (account_id, tag)
) STRICT;
