2WOOGXDHVQ6L2MQYUTLJ6H6FVSQNJN6SMJL5DG7HAHFYPJLRT2SAC MOUWNVYREOS635V7ZCSADM4JLGHTUPLJ6G63GPU6P7FDDDIQ6SNQC E2KOBKIJ2QMMC77UYNURGCTDGAIIRMBJNG7BMVLSFFPK5RAZ7KFAC MMRVIM3FRSHP3XB37L7YAQVF4DXDSRRIC5UJS6NSD2LGTQSZJIMQC AXKKXBWN4EMUOLV43WN52JSKJPBV7TLSGLNJW5EZXHSJNKCYUWOQC EQXRXRZDYCM7BDAVBOXQYPG6C7IJT3OFGNIXCDAHJJBRKAXNGL7AC ZITLSTYXUOESFELOW3DLBKWKMSS5ZJYCTKMK4Z44WGIYAKYSMMVAC NVOCQVASZWTKQJG7GPH7KHKZZR7NUG4WLV5YY4KAIRPCJRWCZPIAC GCVQD44VRPQVKPZEPIC4AOIXLJIG2ZMV3QI2Y7KALUT6NVUBSGSAC PBD7LZYQHXAA3KLH2ZUX5GW4UFML6BQ32KXZF4KZ6OYFASUYFJ5QC 2G3GNDDUOVPF45PELJ65ZB2IXEHJJXJILFRVHZXGPXUL4BVNZJFQC EZQG2APB36DDMIAYDPPDGOIXOD7K2RZZSGC2NKGZIHB2HZBTW7EQC FD7SV5I6VCW27HZ3T3K4MMGB2OYGJTPKFFA263TNTAMRJGQJWVNAC 2XQD6KKKD6QVHFHAEMVE3XXY7X2T7BLTLL7XIILZAXNJJH2YONUQC -- create extension if not exists "uuid-ossp";
Description: (Describe migration here.)Created: 2016-10-13 05:36:59.592247 UTCDepends:Apply: |create extension if not exists "uuid-ossp";create table if not exists users (id uuid primary key default uuid_generate_v4(),handle text not null,btc_addr text not null,email text not null);create table if not exists projects (id uuid primary key default uuid_generate_v4(),project_name text not null,inception_date timestamp with time zone not null,initiator_id uuid references users (id) not null);
create table users (id uuid primary key default uuid_generate_v4(),handle text not null,btc_addr text not null,email text not null);
create table if not exists project_companions (project_id uuid references projects(id) not null,user_id uuid references users(id) not null);
create table projects (id uuid primary key default uuid_generate_v4(),project_name text not null,inception_date timestamp with time zone not null,initiator_id uuid references users (id) not null);
create type event_t as enum ('start', 'stop');
create table project_companions (project_id uuid references projects(id) not null,user_id uuid references users(id) not null);
create table if not exists work_events (id uuid primary key default uuid_generate_v4(),project_id uuid references projects(id) not null,user_id uuid references users(id) not null,btc_addr text not null,event_type event_t not null,event_time timestamp with time zone not null,event_metadata json not null);
create type event_t as enum ('start', 'stop');
create table if not exists auctions (id uuid primary key default uuid_generate_v4(),project_id uuid references projects(id) not null,initiator_id uuid references users (id) not null,raise_amount numeric not null,end_time timestamp with time zone not null);
create table work_events (id uuid primary key default uuid_generate_v4(),project_id uuid references projects(id) not null,user_id uuid references users(id) not null,btc_addr text not null,event_type event_t not null,event_time timestamp with time zone not null,event_metadata json not null);
create table if not exists bids (id uuid primary key default uuid_generate_v4(),auction_id uuid references projects (id) not null,bidder_id uuid references users (id) not null,bid_seconds integer not null,bid_amount numeric not null,bid_time timestamp with time zone not null);
create table auctions (id uuid primary key default uuid_generate_v4(),project_id uuid references projects(id) not null,initiator_id uuid references users (id) not null,raise_amount numeric not null,end_time timestamp with time zone not null);
Revert: |drop table bids;drop table auctions;drop table work_events;drop table project_companions;drop table projects;drop table users;
create table bids (id uuid primary key default uuid_generate_v4(),auction_id uuid references projects (id) not null,bidder_id uuid references users (id) not null,bid_seconds integer not null,bid_amount numeric not null,bid_time timestamp with time zone not null);
alter table projects add depreciation_fn json not null default '{"type": "LinearDepreciation", "arguments": {"undep": 6, "dep": 60}}';
Description: (Describe migration here.)Created: 2016-10-14 02:11:28.829909 UTCDepends: 2016-10-13_05-36-55_user-event-logApply: |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;
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;
alter table project_companionsadd joined_at timestamp with time zone not nulldefault (now() at time zone 'UTC');
alter table project_companionsadd joined_at timestamp with time zone not nulldefault (now() at time zone 'UTC');
Revert: |alter table projects drop column depreciation_fn;alter table project_companions drop column invited_by;alter table project_companions drop column joined_at;
create table invitations (id uuid primary key default uuid_generate_v4(),project_id uuid references projects(id) not null,invitor_id uuid references users (id) not null,invitee_email text not null,invitation_key text not null,invitation_time timestamp with time zone not null default (now() at time zone 'UTC'),acceptance_time timestamp with time zone);
Description: (Describe migration here.)Created: 2016-10-14 02:14:22.631128 UTCDepends: 2016-10-14_02-11-24_project_companions_invitations 2016-10-13_05-36-55_user-event-logApply: |create table if not exists invitations (id uuid primary key default uuid_generate_v4(),project_id uuid references projects(id) not null,invitor_id uuid references users (id) not null,invitee_email text not null,invitation_key text not null,invitation_time timestamp with time zone not null default (now() at time zone 'UTC'),acceptance_time timestamp with time zone);Revert: |drop table invitations;