-- profile updates table
CREATE TABLE IF NOT EXISTS profile_updates (
  id integer PRIMARY KEY AUTOINCREMENT,
  contact_id integer,
  version_id integer,
	field_name varchar(64),
  field_value varchar(2048),
  action varchar(8),
  timestamps integer
);
CREATE INDEX IF NOT EXISTS contact_id_index on profile_updates ( contact_id );

-- messages table
CREATE TABLE IF NOT EXISTS messages (
  id integer PRIMARY KEY AUTOINCREMENT,
  uuid VARCHAR(40),
  src_public_key VARCHAR(64),
  dst_public_key VARCHAR(64),
  content_path varchar(128),
  received_at integer,
  delivered_at integer,
  delivered boolean
);
CREATE INDEX IF NOT EXISTS contact_id_index on messages ( contact_id );