ZITLSTYXUOESFELOW3DLBKWKMSS5ZJYCTKMK4Z44WGIYAKYSMMVAC
QMRKFEPGFBCEWAIXPEIG5ILKAJ2JH5L3TOITHR4HNJXK5FN3KXBQC
IZEVQF627FA7VV25KJAWYWGGC35LZUUBBQRPN5ZAINTQLPEDRTEAC
NVOCQVASZWTKQJG7GPH7KHKZZR7NUG4WLV5YY4KAIRPCJRWCZPIAC
EQXRXRZDYCM7BDAVBOXQYPG6C7IJT3OFGNIXCDAHJJBRKAXNGL7AC
RLDPSLKK5372WOAUR6BPOBX4PFN76BLE2E23IDIFCNM4X4NBJIIAC
4U7F3CPIDTK6JSEDMNMHVKSR7HOQDLZQD2PPVMDLHO5SFSIMUXZAC
"SELECT p.id, p.project_name, p.inception_date, p.initiator_id \
\FROM projects p JOIN project_companions pc ON pc.project_id = p.id \
\WHERE pc.user_id = ? \
\UNION \
\SELECT p.id, p.project_name, p.inception_date, p.initiator_id \
\FROM projects p \
\WHERE p.initiator_id = ?"
"SELECT p.id, p.project_name, p.inception_date, p.initiator_id, p.depreciation_fn \
\FROM projects p LEFT OUTER JOIN project_companions pc ON pc.project_id = p.id \
\WHERE pc.user_id = ? \
\OR p.initiator_id = ?"
CREATE TABLE work_events (btc_addr TEXT, event_type TEXT, event_time INTEGER);
CREATE TABLE auctions (raise_amount INTEGER, end_time INTEGER);
CREATE TABLE bids (auction_id INTEGER, user_id INTEGER, bid_seconds INTEGER, bid_amount INTEGER, bid_time INTEGER);
create table users (btc_addr TEXT, email TEXT);
alter table projects add depreciation_fn json not null default '{"type": "LinearDepreciation", "arguments": {"undep": 6, "dep": 60}}';
alter table project_companions add invited_by uuid references users(id);
update project_companions set invited_by = user_id; --
alter table project_companions alter column invited_by set not null;