~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
-- Copyright 2009 Canonical Ltd.  This software is licensed under the
-- GNU Affero General Public License version 3 (see the file LICENSE).

-- Generated by:
-- pg_dump --format=p --schema-only --no-owner --no-privileges \
--     --table=Account --table=AccountPassword --table=AuthToken \
--     --table=EmailAddress --table=OpenIDAssociation \
--     --table=OpenIDAuthorization --table=OpenIDNonce \
--     --table=OpenIDRPSummary --table=ValidPersonCache \
--     --table=ValidPersonOrTeamCache launchpad_prod_4

--
-- PostgreSQL database dump
--

SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: account; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE account (
    id integer NOT NULL,
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
    creation_rationale integer NOT NULL,
    status integer NOT NULL,
    date_status_set timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
    displayname text NOT NULL,
    openid_identifier text DEFAULT generate_openid_identifier() NOT NULL,
    status_comment text,
    old_openid_identifier text
);


--
-- Name: TABLE account; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE account IS 'An account that may be used for authenticating to Canonical or other systems.';


--
-- Name: COLUMN account.status; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN account.status IS 'The status of the account.';


--
-- Name: COLUMN account.date_status_set; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN account.date_status_set IS 'When the status was last changed.';


--
-- Name: COLUMN account.displayname; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN account.displayname IS 'Name to display when rendering information about this account.';


--
-- Name: COLUMN account.openid_identifier; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN account.openid_identifier IS 'The key used to construct an OpenID identity URL for this account.';


--
-- Name: COLUMN account.status_comment; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN account.status_comment IS 'The comment on the status of the account.';


--
-- Name: COLUMN account.old_openid_identifier; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN account.old_openid_identifier IS 'The previous openid_identifier, used for transitions to the current openid_identifier.';


--
-- Name: account_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE account_id_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- Name: account_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE account_id_seq OWNED BY account.id;


--
-- Name: accountpassword; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE accountpassword (
    id integer NOT NULL,
    account integer NOT NULL,
    password text NOT NULL
);


--
-- Name: TABLE accountpassword; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE accountpassword IS 'A password used to authenticate an Account.';


--
-- Name: COLUMN accountpassword.password; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN accountpassword.password IS 'SSHA digest encrypted password.';


--
-- Name: accountpassword_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE accountpassword_id_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- Name: accountpassword_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE accountpassword_id_seq OWNED BY accountpassword.id;


--
-- Name: authtoken; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE authtoken (
    id integer NOT NULL,
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
    date_consumed timestamp without time zone,
    token_type integer NOT NULL,
    token text NOT NULL,
    requester integer,
    requester_email text,
    email text NOT NULL,
    redirection_url text
);


--
-- Name: TABLE authtoken; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE authtoken IS 'AuthToken stores one time tokens used by the authentication service for validating email addresses and other tasks that require verifying an email address is valid such as password recovery and account merging. This table will be cleaned occasionally to remove expired tokens. Expiry time is not yet defined.';


--
-- Name: COLUMN authtoken.date_created; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN authtoken.date_created IS 'The timestamp that this request was made.';


--
-- Name: COLUMN authtoken.date_consumed; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN authtoken.date_consumed IS 'The date and time when this token was consumed. It''s NULL if it hasn''t been consumed yet.';


--
-- Name: COLUMN authtoken.token_type; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN authtoken.token_type IS 'The type of request, as per dbschema.TokenType.';


--
-- Name: COLUMN authtoken.token; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN authtoken.token IS 'The token (not the URL) emailed used to uniquely identify this request. This token will be used to generate a URL that when clicked on will continue a workflow.';


--
-- Name: COLUMN authtoken.requester; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN authtoken.requester IS 'The Account that made this request. This will be null for password recovery requests.';


--
-- Name: COLUMN authtoken.requester_email; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN authtoken.requester_email IS 'The email address that was used to login when making this request. This provides an audit trail to help the end user confirm that this is a valid request. It is not a link to the EmailAddress table as this may be changed after the request is made. This field will be null for password recovery requests.';


--
-- Name: COLUMN authtoken.email; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN authtoken.email IS 'The email address that this request was sent to.';


--
-- Name: authtoken_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE authtoken_id_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- Name: authtoken_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE authtoken_id_seq OWNED BY authtoken.id;


--
-- Name: emailaddress; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE emailaddress (
    id integer NOT NULL,
    email text NOT NULL,
    person integer,
    status integer NOT NULL,
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
    account integer,
    CONSTRAINT emailaddress__is_linked__chk CHECK (((person IS NOT NULL) OR (account IS NOT NULL)))
);


--
-- Name: COLUMN emailaddress.email; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN emailaddress.email IS 'An email address used by a Person. The email address is stored in a casesensitive way, but must be case insensitivly unique.';


--
-- Name: emailaddress_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE emailaddress_id_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- Name: emailaddress_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE emailaddress_id_seq OWNED BY emailaddress.id;


--
-- Name: openidassociation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE openidassociation (
    server_url character varying(2047) NOT NULL,
    handle character varying(255) NOT NULL,
    secret bytea,
    issued integer,
    lifetime integer,
    assoc_type character varying(64),
    CONSTRAINT secret_length_constraint CHECK ((length(secret) <= 128))
);


--
-- Name: openidauthorization; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE openidauthorization (
    id integer NOT NULL,
    account integer NOT NULL,
    client_id text,
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
    date_expires timestamp without time zone NOT NULL,
    trust_root text NOT NULL
);


--
-- Name: openidauthorization_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE openidauthorization_id_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- Name: openidauthorization_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE openidauthorization_id_seq OWNED BY openidauthorization.id;


--
-- Name: openidnonce; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE openidnonce (
    server_url character varying(2047) NOT NULL,
    "timestamp" integer NOT NULL,
    salt character(40) NOT NULL
);


--
-- Name: TABLE openidnonce; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE openidnonce IS 'Nonces for our OpenID consumer.';


--
-- Name: openidrpsummary; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE openidrpsummary (
    id integer NOT NULL,
    account integer NOT NULL,
    openid_identifier text NOT NULL,
    trust_root text NOT NULL,
    date_created timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
    date_last_used timestamp without time zone DEFAULT timezone('UTC'::text, now()) NOT NULL,
    total_logins integer DEFAULT 1 NOT NULL
);


--
-- Name: TABLE openidrpsummary; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE openidrpsummary IS 'The summary of the activity between a person and an RP.';


--
-- Name: COLUMN openidrpsummary.account; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN openidrpsummary.account IS 'The account who used the RP.';


--
-- Name: COLUMN openidrpsummary.openid_identifier; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN openidrpsummary.openid_identifier IS 'The OpenID identifier used to login.';


--
-- Name: COLUMN openidrpsummary.trust_root; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN openidrpsummary.trust_root IS 'The trust root for the RP';


--
-- Name: COLUMN openidrpsummary.date_created; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN openidrpsummary.date_created IS 'The creation date of this summary; the first time the person used the RP.';


--
-- Name: COLUMN openidrpsummary.date_last_used; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN openidrpsummary.date_last_used IS 'The date the RP was last used.';


--
-- Name: COLUMN openidrpsummary.total_logins; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN openidrpsummary.total_logins IS 'The total number of times the RP was used by the person.';


--
-- Name: openidrpsummary_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE openidrpsummary_id_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


--
-- Name: openidrpsummary_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE openidrpsummary_id_seq OWNED BY openidrpsummary.id;


--
-- Name: validpersoncache; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW validpersoncache AS
    SELECT emailaddress.person AS id FROM emailaddress, account WHERE ((((emailaddress.account = account.id) AND (emailaddress.person IS NOT NULL)) AND (emailaddress.status = 4)) AND (account.status = 20));


--
-- Name: VIEW validpersoncache; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON VIEW validpersoncache IS 'A materialized view listing the Person.ids of all valid people (but not teams).';


--
-- Name: validpersonorteamcache; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW validpersonorteamcache AS
    SELECT person.id FROM ((person LEFT JOIN emailaddress ON ((person.id = emailaddress.person))) LEFT JOIN account ON ((emailaddress.account = account.id))) WHERE ((person.teamowner IS NOT NULL) OR ((account.status = 20) AND (emailaddress.status = 4)));


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE account ALTER COLUMN id SET DEFAULT nextval('account_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE accountpassword ALTER COLUMN id SET DEFAULT nextval('accountpassword_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE authtoken ALTER COLUMN id SET DEFAULT nextval('authtoken_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE emailaddress ALTER COLUMN id SET DEFAULT nextval('emailaddress_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE openidauthorization ALTER COLUMN id SET DEFAULT nextval('openidauthorization_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE openidrpsummary ALTER COLUMN id SET DEFAULT nextval('openidrpsummary_id_seq'::regclass);


--
-- Name: account_openid_identifier_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY account
    ADD CONSTRAINT account_openid_identifier_key UNIQUE (openid_identifier);


--
-- Name: account_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY account
    ADD CONSTRAINT account_pkey PRIMARY KEY (id);


--
-- Name: accountpassword_account_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY accountpassword
    ADD CONSTRAINT accountpassword_account_key UNIQUE (account);


--
-- Name: accountpassword_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY accountpassword
    ADD CONSTRAINT accountpassword_pkey PRIMARY KEY (id);


--
-- Name: authtoken__token__key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY authtoken
    ADD CONSTRAINT authtoken__token__key UNIQUE (token);


--
-- Name: authtoken_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY authtoken
    ADD CONSTRAINT authtoken_pkey PRIMARY KEY (id);


--
-- Name: emailaddress_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY emailaddress
    ADD CONSTRAINT emailaddress_pkey PRIMARY KEY (id);


--
-- Name: openidassociation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY openidassociation
    ADD CONSTRAINT openidassociation_pkey PRIMARY KEY (server_url, handle);


--
-- Name: openidauthorization_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY openidauthorization
    ADD CONSTRAINT openidauthorization_pkey PRIMARY KEY (id);


--
-- Name: openidnonce_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY openidnonce
    ADD CONSTRAINT openidnonce_pkey PRIMARY KEY (server_url, "timestamp", salt);


--
-- Name: openidrpsummary__account__trust_root__openid_identifier__key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY openidrpsummary
    ADD CONSTRAINT openidrpsummary__account__trust_root__openid_identifier__key UNIQUE (account, trust_root, openid_identifier);


--
-- Name: openidrpsummary_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY openidrpsummary
    ADD CONSTRAINT openidrpsummary_pkey PRIMARY KEY (id);


--
-- Name: account__old_openid_identifier__idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX account__old_openid_identifier__idx ON account USING btree (old_openid_identifier);


--
-- Name: authtoken__date_consumed__idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX authtoken__date_consumed__idx ON authtoken USING btree (date_consumed);


--
-- Name: authtoken__date_created__idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX authtoken__date_created__idx ON authtoken USING btree (date_created);


--
-- Name: authtoken__requester__idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX authtoken__requester__idx ON authtoken USING btree (requester);


--
-- Name: emailaddress__account__key; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX emailaddress__account__key ON emailaddress USING btree (account) WHERE ((status = 4) AND (account IS NOT NULL));


--
-- Name: INDEX emailaddress__account__key; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON INDEX emailaddress__account__key IS 'Ensures that an Account only has one preferred email address';


--
-- Name: emailaddress__lower_email__key; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emailaddress__lower_email__key ON emailaddress USING btree (lower(email));


--
-- Name: emailaddress__person__key; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX emailaddress__person__key ON emailaddress USING btree (person) WHERE ((status = 4) AND (person IS NOT NULL));


--
-- Name: INDEX emailaddress__person__key; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON INDEX emailaddress__person__key IS 'Ensures that a Person only has one preferred email address';


--
-- Name: emailaddress__person__status__idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX emailaddress__person__status__idx ON emailaddress USING btree (person, status);


--
-- Name: openidauthorixation__account__troot__expires__client_id__idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX openidauthorixation__account__troot__expires__client_id__idx ON openidauthorization USING btree (account, trust_root, date_expires, client_id);


--
-- Name: openidauthorixation__account__trust_root__key; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX openidauthorixation__account__trust_root__key ON openidauthorization USING btree (account, trust_root) WHERE (client_id IS NULL);


--
-- Name: openidauthorization__account__client_id__trust_root__key; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX openidauthorization__account__client_id__trust_root__key ON openidauthorization USING btree (account, client_id, trust_root) WHERE (client_id IS NOT NULL);


--
-- Name: openidrpsummary__openid_identifier__idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX openidrpsummary__openid_identifier__idx ON openidrpsummary USING btree (openid_identifier);


--
-- Name: openidrpsummary__trust_root__idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX openidrpsummary__trust_root__idx ON openidrpsummary USING btree (trust_root);


--
-- Name: _sl_logtrigger_200; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER _sl_logtrigger_200
    AFTER INSERT OR DELETE OR UPDATE ON account
    FOR EACH ROW
    EXECUTE PROCEDURE _sl.logtrigger('_sl', '200', 'kvvvvvvvv');


--
-- Name: _sl_logtrigger_201; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER _sl_logtrigger_201
    AFTER INSERT OR DELETE OR UPDATE ON accountpassword
    FOR EACH ROW
    EXECUTE PROCEDURE _sl.logtrigger('_sl', '201', 'kvv');


--
-- Name: _sl_logtrigger_274; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER _sl_logtrigger_274
    AFTER INSERT OR DELETE OR UPDATE ON emailaddress
    FOR EACH ROW
    EXECUTE PROCEDURE _sl.logtrigger('_sl', '274', 'kvvvvv');


--
-- Name: _sl_logtrigger_335; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER _sl_logtrigger_335
    AFTER INSERT OR DELETE OR UPDATE ON openidauthorization
    FOR EACH ROW
    EXECUTE PROCEDURE _sl.logtrigger('_sl', '335', 'kvvvvv');


--
-- Name: _sl_logtrigger_337; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER _sl_logtrigger_337
    AFTER INSERT OR DELETE OR UPDATE ON openidrpsummary
    FOR EACH ROW
    EXECUTE PROCEDURE _sl.logtrigger('_sl', '337', 'kvvvvvv');


--
-- Name: _sl_logtrigger_438; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER _sl_logtrigger_438
    AFTER INSERT OR DELETE OR UPDATE ON authtoken
    FOR EACH ROW
    EXECUTE PROCEDURE _sl.logtrigger('_sl', '438', 'kvvvvvvvv');


--
-- Name: _sl_logtrigger_439; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER _sl_logtrigger_439
    AFTER INSERT OR DELETE OR UPDATE ON openidassociation
    FOR EACH ROW
    EXECUTE PROCEDURE _sl.logtrigger('_sl', '439', 'kkvvvv');


--
-- Name: _sl_logtrigger_445; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER _sl_logtrigger_445
    AFTER INSERT OR DELETE OR UPDATE ON openidnonce
    FOR EACH ROW
    EXECUTE PROCEDURE _sl.logtrigger('_sl', '445', 'kkk');


--
-- Name: set_date_status_set_t; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER set_date_status_set_t
    BEFORE UPDATE ON account
    FOR EACH ROW
    EXECUTE PROCEDURE set_date_status_set();


--
-- Name: accountpassword_account_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY accountpassword
    ADD CONSTRAINT accountpassword_account_fkey FOREIGN KEY (account) REFERENCES account(id) ON DELETE CASCADE;


--
-- Name: authtoken__requester__fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY authtoken
    ADD CONSTRAINT authtoken__requester__fk FOREIGN KEY (requester) REFERENCES account(id);


--
-- Name: emailaddress__account__fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY emailaddress
    ADD CONSTRAINT emailaddress__account__fk FOREIGN KEY (account) REFERENCES account(id) ON DELETE SET NULL;


--
-- Name: openidauthorization__account__fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY openidauthorization
    ADD CONSTRAINT openidauthorization__account__fk FOREIGN KEY (account) REFERENCES account(id);


--
-- Name: openidrpsummary_account_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY openidrpsummary
    ADD CONSTRAINT openidrpsummary_account_fkey FOREIGN KEY (account) REFERENCES account(id);


--
-- PostgreSQL database dump complete
--

CREATE INDEX emailaddress__account__status__idx
    ON EmailAddress(account, status);


-- Permissions for Ubuntu SSO server testing on staging.

-- Mirrored from sso_auth user 2010-01-12.
-- These tables will eventually not be available.
--
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE account TO ubuntu_sso;
GRANT USAGE ON SEQUENCE account_id_seq TO ubuntu_sso;
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE accountpassword TO ubuntu_sso;
GRANT USAGE ON SEQUENCE accountpassword_id_seq TO ubuntu_sso;
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE authtoken TO ubuntu_sso;
GRANT USAGE ON SEQUENCE authtoken_id_seq TO ubuntu_sso;
GRANT SELECT ON TABLE person TO ubuntu_sso;
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE emailaddress TO ubuntu_sso;
GRANT USAGE ON SEQUENCE emailaddress_id_seq TO ubuntu_sso;
GRANT SELECT,INSERT,DELETE ON TABLE openidassociation TO ubuntu_sso;
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE openidauthorization TO ubuntu_sso;
GRANT USAGE ON SEQUENCE openidauthorization_id_seq TO ubuntu_sso;
GRANT SELECT,INSERT,DELETE ON TABLE openidnonce TO ubuntu_sso;
GRANT SELECT,INSERT,UPDATE ON TABLE openidrpsummary TO ubuntu_sso;
GRANT USAGE ON SEQUENCE openidrpsummary_id_seq TO ubuntu_sso;
GRANT SELECT ON SEQUENCE person_id_seq TO ubuntu_sso;
GRANT SELECT ON TABLE personlocation TO ubuntu_sso;
GRANT SELECT ON SEQUENCE personlocation_id_seq TO ubuntu_sso;
GRANT SELECT ON TABLE teamparticipation TO ubuntu_sso;
GRANT SELECT ON SEQUENCE teamparticipation_id_seq TO ubuntu_sso;

-- Permissions on the Ubuntu SSO tables.
--
GRANT SELECT, INSERT, DELETE, UPDATE ON TABLE auth_permission,
auth_group_permissions, auth_group, auth_user, auth_user_groups,
auth_user_user_permissions, auth_message, django_content_type,
django_session, django_site, django_admin_log,
ssoopenidrpconfig TO ubuntu_sso;

GRANT USAGE ON SEQUENCE auth_group_id_seq,
auth_group_permissions_id_seq, auth_message_id_seq,
auth_permission_id_seq, auth_user_groups_id_seq, auth_user_id_seq,
auth_user_user_permissions_id_seq, django_admin_log_id_seq,
django_content_type_id_seq, django_site_id_seq,
ssoopenidrpconfig_id_seq TO ubuntu_sso;

-- Permissions on the lpmirror tables (mirrors of relevant Launchpad
-- information, available even when Launchpad database upgrades are in
-- progress).
GRANT SELECT ON TABLE lp_person, lp_personlocation, lp_teamparticipation
TO ubuntu_sso;