My schema looks something like this:
CREATE TABLE plans (
id SERIAL PRIMARY KEY,
description text
);
CREATE TABLE projects (
id SERIAL PRIMARY KEY,
project_id character varying(240) UNIQUE,
plan_id integer REFERENCES plans(id) ON DELETE CASCADE
);
And I want to do Storm queries along the lines of
plan = store.find(Plan, Plan.project_id == "alpha")
# should translate to something like
# SELECT p.* from plans p LEFT JOIN projects proj ON p.id = proj.plan_id
# WHERE proj.project_id = 'alpha';
(Note that projects.plan_id
is not unique.)
How do I set this up?