root/sql/schema.sql

Revision 7de429d08625671e3471252391c6ef0bc9c5cf82, 1.4 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 10 years ago)

loading schema

  • Property mode set to 100644
Line 
1 BEGIN;
2
3 CREATE USER stratcon;
4
5 CREATE SCHEMA stratcon;
6
7 CREATE TABLE stratcon.loading_dock_check (
8   remote_address inet,
9   whence timestamptz not null,
10   id uuid not null,
11   target text not null,
12   module text not null,
13   name text not null,
14   PRIMARY KEY(id,whence)
15 );
16 CREATE TABLE stratcon.loading_dock_status (
17   remote_address inet,
18   whence timestamptz not null,
19   id uuid not null,
20   state char(1) not null,
21   availability char(1) not null,
22   duration integer not null,
23   status text,
24   PRIMARY KEY(id,whence)
25 );
26 -- There's so much data in these tables, it would
27 -- be crazy not to specify a date range. So...
28 -- whence is first in the PK.
29 CREATE TABLE stratcon.loading_dock_metric_numeric (
30   remote_address inet,
31   whence timestamptz not null,
32   id uuid not null,
33   name text not null,
34   type char(1) not null,
35   value numeric,
36   PRIMARY KEY(whence,id,name)
37 );
38 CREATE TABLE stratcon.loading_dock_metric_text (
39   remote_address inet,
40   whence timestamptz not null,
41   id uuid not null,
42   name text not null,
43   type char(1) not null,
44   value text,
45   PRIMARY KEY(whence,id,name)
46 );
47
48 GRANT USAGE ON SCHEMA stratcon TO stratcon;
49 GRANT INSERT ON stratcon.loading_dock_check TO stratcon;
50 GRANT INSERT ON stratcon.loading_dock_status TO stratcon;
51 GRANT INSERT ON stratcon.loading_dock_metric_numeric TO stratcon;
52 GRANT INSERT ON stratcon.loading_dock_metric_text TO stratcon;
53
54 COMMIT;
Note: See TracBrowser for help on using the browser.