]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - db/08to09_pg.sql
Notice title constructor doesn't check class of Notice
[quix0rs-gnu-social.git] / db / 08to09_pg.sql
1 -- SQL commands to update an 0.8.x version of Laconica
2 -- to 0.9.x.
3
4 --these are just comments
5 /*
6 alter table notice
7      modify column content text comment 'update content';
8
9 alter table message
10      modify column content text comment 'message content';
11
12 alter table profile
13      modify column bio text comment 'descriptive biography';
14
15 alter table user_group
16      modify column description text comment 'group description';
17 */
18
19 alter table file_oembed
20      add column mimetype varchar(50) /*comment 'mime type of resource'*/;
21
22 create table config (
23
24     section varchar(32) /* comment 'configuration section'*/,
25     setting varchar(32) /* comment 'configuration setting'*/,
26     value varchar(255) /* comment 'configuration value'*/,
27
28     primary key (section, setting)
29
30 );
31
32 create table profile_role (
33
34     profile_id integer not null /* comment 'account having the role'*/ references profile (id),
35     role    varchar(32) not null /* comment 'string representing the role'*/,
36     created timestamp /* not null comment 'date the role was granted'*/,
37
38     primary key (profile_id, role)
39
40 );
41
42 create table location_namespace (
43
44     id integer /*comment 'identity for this namespace'*/,
45     description text /* comment 'description of the namespace'*/ ,
46     created integer not null /*comment 'date the record was created*/ ,
47    /* modified timestamp comment 'date this record was modified',*/
48     primary key (id)
49
50 );
51
52 create table login_token (
53     user_id integer not null /* comment 'user owning this token'*/ references "user" (id),
54     token char(32) not null /* comment 'token useable for logging in'*/,
55     created timestamp not null DEFAULT CURRENT_TIMESTAMP /* comment 'date this record was created'*/,
56     modified timestamp /* comment 'date this record was modified'*/,
57
58     primary key (user_id)
59 );
60
61 DROP index fave_user_id_idx;
62 CREATE index fave_user_id_idx on fave (user_id,modified);
63
64 DROP index subscription_subscriber_idx;
65 CREATE index subscription_subscriber_idx ON subscription (subscriber,created);
66
67 DROP index subscription_subscribed_idx;
68 CREATE index subscription_subscribed_idx ON subscription (subscribed,created);
69
70 DROP index notice_profile_id_idx;
71 CREATE index notice_profile_id_idx ON notice (profile_id,created,id);
72
73 ALTER TABLE notice ADD COLUMN lat decimal(10, 7) /* comment 'latitude'*/;
74 ALTER TABLE notice ADD COLUMN lon decimal(10,7) /* comment 'longitude'*/;
75 ALTER TABLE notice ADD COLUMN location_id integer /* comment 'location id if possible'*/ ;
76 ALTER TABLE notice ADD COLUMN location_ns integer /* comment 'namespace for location'*/;
77 ALTER TABLE notice ADD COLUMN repeat_of integer /* comment 'notice this is a repeat of' */ references notice (id);
78
79 ALTER TABLE profile ADD COLUMN lat decimal(10,7) /*comment 'latitude'*/ ;
80 ALTER TABLE profile ADD COLUMN lon decimal(10,7) /*comment 'longitude'*/;
81 ALTER TABLE profile ADD COLUMN location_id integer /* comment 'location id if possible'*/;
82 ALTER TABLE profile ADD COLUMN location_ns integer /* comment 'namespace for location'*/;
83
84 ALTER TABLE consumer add COLUMN consumer_secret varchar(255) not null ; /*comment 'secret value'*/
85
86 ALTER TABLE token ADD COLUMN verifier varchar(255); /* comment 'verifier string for OAuth 1.0a',*/
87 ALTER TABLE token ADD COLUMN verified_callback varchar(255); /* comment 'verified callback URL for OAuth 1.0a',*/
88
89 create table queue_item_new (
90      id serial /* comment 'unique identifier'*/,
91      frame bytea not null /* comment 'data: object reference or opaque string'*/,
92      transport varchar(8) not null /*comment 'queue for what? "email", "jabber", "sms", "irc", ...'*/,
93      created timestamp not null default CURRENT_TIMESTAMP /*comment 'date this record was created'*/,
94      claimed timestamp /*comment 'date this item was claimed'*/,
95      PRIMARY KEY (id)
96 );
97  
98 insert into queue_item_new (frame,transport,created,claimed)
99     select ('0x' || notice_id::text)::bytea,transport,created,claimed from queue_item;
100 alter table queue_item rename to queue_item_old;
101 alter table queue_item_new rename to queue_item;
102
103 ALTER TABLE confirm_address ALTER column sent set default CURRENT_TIMESTAMP;
104
105 create table user_location_prefs (
106     user_id integer not null /*comment 'user who has the preference'*/ references "user" (id),
107     share_location int default 1 /* comment 'Whether to share location data'*/,
108     created timestamp not null /*comment 'date this record was created'*/,
109     modified timestamp /* comment 'date this record was modified'*/,
110
111     primary key (user_id)
112 );
113  
114 create table inbox (
115
116     user_id integer not null /* comment 'user receiving the notice' */ references "user" (id),
117     notice_ids bytea /* comment 'packed list of notice ids' */,
118
119     primary key (user_id)
120
121 );
122