~launchpad-pqm/launchpad/devel

8687.15.9 by Karl Fogel
Add the copyright header block to more files (everything under database/).
1
-- Copyright 2009 Canonical Ltd.  This software is licensed under the
2
-- GNU Affero General Public License version 3 (see the file LICENSE).
1064.1.5 by James Henstridge
add sample data, and hook up placeholder for calendar
3
1064.1.12 by James Henstridge
add infrastructure to put up a month view (no data though)
4
-- update pg_ts_cfg set locale='en_AU.UTF-8' where ts_name = 'default';
5
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
6
7
-- Create some calendars
8
1650.2.10 by James Henstridge
remove owner field from Calendar table
9
INSERT INTO Calendar (title, revision)
10
    VALUES ('Sample Person\'s Calendar', 0);
1064.1.45 by James Henstridge
add timezone_name column to person table, add code to get timezone for request principal
11
UPDATE Person SET calendar = (SELECT id FROM Calendar WHERE title = 'Sample Person\'s Calendar'),
1650.2.36 by James Henstridge
fix issues brought up in stub's review. Rename startdate back to dtstart
12
                  timezone = 'Australia/Perth'
1064.1.24 by James Henstridge
update sample data to add a few events
13
    WHERE id = (SELECT id from Person WHERE displayname = 'Sample Person');
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
14
1650.2.10 by James Henstridge
remove owner field from Calendar table
15
INSERT INTO Calendar (title, revision)
16
    VALUES ('Foo Bar\'s Calendar', 0);
1064.1.45 by James Henstridge
add timezone_name column to person table, add code to get timezone for request principal
17
UPDATE Person SET calendar = (SELECT id FROM Calendar WHERE title = 'Foo Bar\'s Calendar'),
1650.2.36 by James Henstridge
fix issues brought up in stub's review. Rename startdate back to dtstart
18
                  timezone = 'Africa/Johannesburg'
1064.1.37 by James Henstridge
add description field to event table
19
    WHERE id = (SELECT id from Person WHERE displayname = 'Foo Bar');
1064.1.6 by James Henstridge
get canonical.launchpad.database.Person to create its calendar on demand
20
1650.2.10 by James Henstridge
remove owner field from Calendar table
21
INSERT INTO Calendar (title, revision)
22
    VALUES ('Ubuntu Project Calendar', 0);
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
23
UPDATE Project SET calendar = (SELECT id FROM Calendar WHERE title = 'Ubuntu Project Calendar')
24
    WHERE id = (SELECT id from Project WHERE name = 'ubuntu');
25
26
27
-- Add some subscriptions for "Sample Person"
28
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
29
INSERT INTO CalendarSubscription (subject, object, colour)
30
    VALUES ((SELECT id FROM Calendar WHERE title = 'Sample Person\'s Calendar'),
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
31
            (SELECT id FROM Calendar WHERE title = 'Sample Person\'s Calendar'),
1064.1.64 by James Henstridge
add calendar info portlets to product and project index pages
32
            '#c0d0ff');
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
33
INSERT INTO CalendarSubscription (subject, object, colour)
34
    VALUES ((SELECT id FROM Calendar WHERE title = 'Sample Person\'s Calendar'),
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
35
            (SELECT id FROM Calendar WHERE title = 'Foo Bar\'s Calendar'),
1064.1.64 by James Henstridge
add calendar info portlets to product and project index pages
36
            '#c0ffc8');
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
37
INSERT INTO CalendarSubscription (subject, object, colour)
38
    VALUES ((SELECT id FROM Calendar WHERE title = 'Sample Person\'s Calendar'),
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
39
            (SELECT id FROM Calendar WHERE title = 'Ubuntu Project Calendar'),
40
            '#faffd2');
41
42
-- Subscriptions for "Foo Bar"
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
43
INSERT INTO CalendarSubscription (subject, object, colour)
44
    VALUES ((SELECT id FROM Calendar WHERE title = 'Foo Bar\'s Calendar'),
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
45
            (SELECT id FROM Calendar WHERE title = 'Foo Bar\'s Calendar'),
1064.1.64 by James Henstridge
add calendar info portlets to product and project index pages
46
            '#c0ffc8');
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
47
INSERT INTO CalendarSubscription (subject, object, colour)
48
    VALUES ((SELECT id FROM Calendar WHERE title = 'Foo Bar\'s Calendar'),
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
49
            (SELECT id FROM Calendar WHERE title = 'Sample Person\'s Calendar'),
1064.1.64 by James Henstridge
add calendar info portlets to product and project index pages
50
            '#c0d0ff');
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
51
52
-- Add events to "Sample Person's Calendar"
1650.2.36 by James Henstridge
fix issues brought up in stub's review. Rename startdate back to dtstart
53
INSERT INTO CalendarEvent (uid, calendar, dtstart, duration,
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
54
                           title, description, location)
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
55
    VALUES ('sample-id-1@launchpad.example.org', (SELECT id FROM Calendar WHERE title = 'Sample Person\'s Calendar'),
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
56
            '2005-01-03 08:00:00', '01:00:00', 'Event 1', 'Desc 1', 'Location');
1650.2.36 by James Henstridge
fix issues brought up in stub's review. Rename startdate back to dtstart
57
INSERT INTO CalendarEvent (uid, calendar, dtstart, duration,
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
58
                           title, description, location)
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
59
    VALUES ('sample-id-2@launchpad.example.org', (SELECT id FROM Calendar WHERE title = 'Sample Person\'s Calendar'),
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
60
            '2005-01-03 10:00:00', '01:00:00', 'Event 2', 'Desc 2', 'Location');
1650.2.36 by James Henstridge
fix issues brought up in stub's review. Rename startdate back to dtstart
61
INSERT INTO CalendarEvent (uid, calendar, dtstart, duration,
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
62
                           title, description, location)
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
63
    VALUES ('sample-id-3@launchpad.example.org', (SELECT id FROM Calendar WHERE title = 'Sample Person\'s Calendar'),
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
64
            '2005-01-04 08:00:00', '01:00:00', 'Event 1', 'Desc 1', 'Location');
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
65
66
-- Add events to "Foo Bar's Calendar"
1650.2.36 by James Henstridge
fix issues brought up in stub's review. Rename startdate back to dtstart
67
INSERT INTO CalendarEvent (uid, calendar, dtstart, duration,
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
68
                           title, description, location)
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
69
    VALUES ('sample-id-4@launchpad.example.org', (SELECT id FROM Calendar WHERE title = 'Foo Bar\'s Calendar'),
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
70
            '2005-01-04 08:00:00', '01:00:00', 'Foo Bar 1', 'Desc 1', 'Location');
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
71
72
-- Add events to "Ubuntu Project Calendar"
1650.2.36 by James Henstridge
fix issues brought up in stub's review. Rename startdate back to dtstart
73
INSERT INTO CalendarEvent (uid, calendar, dtstart, duration,
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
74
                           title, description, location)
1064.1.62 by James Henstridge
extend database schema to handle calendars on projects and products
75
    VALUES ('sample-id-5@launchpad.example.org', (SELECT id from Calendar WHERE title = 'Ubuntu Project Calendar'),
1650.2.15 by James Henstridge
convert CalendarSubscription table to a calendar->calendar relation
76
            '2004-12-06 08:00:00', '11 days 08:30:00', 'The Mataro Sessions', 'The Ubuntu conference in Mataro', 'Mataro, Spain');