Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
sql: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeneas Rekkas committed Nov 30, 2015
1 parent 76890fb commit f4321c8
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions storage/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,34 @@ import (
"log"
)

var schemas = []string{`CREATE TABLE client (
id text NOT NULL,
var schemas = []string{`CREATE TABLE IF NOT EXISTS client (
id text NOT NULL PRIMARY KEY,
secret text NOT NULL,
extra text NOT NULL,
redirect_uri text NOT NULL,
CONSTRAINT client_pk PRIMARY KEY (id)
redirect_uri text NOT NULL
)`, `CREATE TABLE IF NOT EXISTS authorize (
client text NOT NULL,
code text NOT NULL,
code text NOT NULL PRIMARY KEY,
expires_in int NOT NULL,
scope text NOT NULL,
redirect_uri text NOT NULL,
state text NOT NULL,
extra text NOT NULL,
created_at timestamp with time zone NOT NULL,
CONSTRAINT authorize_pk PRIMARY KEY (code)
created_at timestamp with time zone NOT NULL
)`, `CREATE TABLE IF NOT EXISTS access (
client text NOT NULL,
authorize text NOT NULL,
previous text NOT NULL,
access_token text NOT NULL,
access_token text NOT NULL PRIMARY KEY,
refresh_token text NOT NULL,
expires_in int NOT NULL,
scope text NOT NULL,
redirect_uri text NOT NULL,
extra text NOT NULL,
created_at timestamp with time zone NOT NULL,
CONSTRAINT access_pk PRIMARY KEY (access_token)
created_at timestamp with time zone NOT NULL
)`, `CREATE TABLE IF NOT EXISTS refresh (
token text NOT NULL,
access text NOT NULL,
CONSTRAINT refresh_pk PRIMARY KEY (token)
token text NOT NULL PRIMARY KEY,
access text NOT NULL
)`}

// Storage implements interface "github.com/RangelReale/osin".Storage and interface "github.com/ory-am/osin-storage".Storage
Expand Down

0 comments on commit f4321c8

Please sign in to comment.