ducky/subscriptions

Paddy 2015-07-13 Parent:61c4ce5850da

7:9e138933e4ce Go to Latest

ducky/subscriptions/sql/postgres_init.sql

Create a client for working with subscriptions. We mostly copied our code.secondbit.org/auth.hg/client package to create a simple client library for communicating with our Subscriptions API. Right now, the client only has support for creating a subscription. It remains untested, but it builds.

History
paddy@1 1 CREATE TABLE IF NOT EXISTS subscriptions (
paddy@1 2 user_id VARCHAR(36) PRIMARY KEY,
paddy@2 3 stripe_subscription VARCHAR(36) UNIQUE NOT NULL,
paddy@2 4 plan VARCHAR(36) NOT NULL,
paddy@2 5 status VARCHAR(16) NOT NULL,
paddy@2 6 canceling BOOLEAN NOT NULL,
paddy@1 7 created TIMESTAMPTZ NOT NULL,
paddy@2 8 trial_start TIMESTAMPTZ NOT NULL,
paddy@2 9 trial_end TIMESTAMPTZ NOT NULL,
paddy@2 10 period_start TIMESTAMPTZ NOT NULL,
paddy@2 11 period_end TIMESTAMPTZ NOT NULL,
paddy@2 12 canceled_at TIMESTAMPTZ NOT NULL,
paddy@2 13 failed_charge_attempts INTEGER NOT NULL,
paddy@2 14 last_failed_charge TIMESTAMPTZ NOT NULL,
paddy@2 15 last_notified TIMESTAMPTZ NOT NULL
paddy@1 16 );