
-- profile versioning table
CREATE TABLE IF NOT EXISTS profile_versions (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  field_name VARCHAR(64),
  field_value VARCHAR(128),
  action VARCHAR(16),
  action_value VARCHAR(16),
  timestamp INTEGER
);
-- messages table
CREATE TABLE IF NOT EXISTS messages (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  uuid VARCHAR(40),
  contact_id INTEGER,
  channel_id INTEGER,
  channel_type INTEGER, -- 1: person, 2: group, 3: public channel
  type INTEGER, -- 1: text, 2: audio, 3: image, 4: movie, 5: file
  content VARCHAR(2048),
  filename VARCHAR(128), -- when type is 1 then value is NuLL string
  path VARCHAR(256), -- when type is 1 then value is NuLL string
  timestamp INTEGER
);