-- Fetch all the Messages belonging to the Gmail 
-- account of a particular user. 
SELECT *
FROM fiber.gmail_message
WHERE account_id = '{user.gmail_id}'
-- Fetch all the Messages belonging to the Gmail 
-- account of a particular user. 
SELECT *
FROM fiber.gmail_message
WHERE account_id = '{user.gmail_id}'
Code
CREATE TABLE fiber.gmail_message (
  id TEXT NOT NULL,
  created_at TIMESTAMP WITH TIME ZONE,
  updated_at TIMESTAMP WITH TIME ZONE,
  account_id TEXT,
  date TIMESTAMP WITH TIME ZONE,
  from TEXT,
  to TEXT,
  headers JSONB,
  subject TEXT,
  thread_id TEXT,
  snippet TEXT,
  payload JSONB
)
CREATE TABLE fiber.gmail_message (
  id TEXT NOT NULL,
  created_at TIMESTAMP WITH TIME ZONE,
  updated_at TIMESTAMP WITH TIME ZONE,
  account_id TEXT,
  date TIMESTAMP WITH TIME ZONE,
  from TEXT,
  to TEXT,
  headers JSONB,
  subject TEXT,
  thread_id TEXT,
  snippet TEXT,
  payload JSONB
)
Model definition