Skip to content

Instantly share code, notes, and snippets.

@awreece
Created November 29, 2017 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awreece/aeacbc818277c7c6d99477645e7fcd03 to your computer and use it in GitHub Desktop.
Save awreece/aeacbc818277c7c6d99477645e7fcd03 to your computer and use it in GitHub Desktop.
CREATE TABLE metrics (
id bytea NOT NULL primary key,
description text,
name text COLLATE pg_catalog."C"
);
CREATE TABLE contribution_metrics (
last_update_on timestamp with time zone,
metric bytea NOT NULL,
projected double precision,
contribution_id bytea NOT NULL,
primary key (contribution_id, metric)
);
CREATE INDEX on contribution_metrics (contribution_id, metric, last_updated_on DESC);
CREATE TABLE contributions (
id bytea NOT NULL PRIMARY KEY,
amount double precision,
investment_id bytea,
metadata jsonb
);
CREATE INDEX ON contributions (investment_id);
create table earnings (
id bytea not null primary key,
note_id bytea not null,
amount int
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment