]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - db/core.php
Don't accept non-objects before testing with "instanceof".
[quix0rs-gnu-social.git] / db / core.php
1 <?php
2
3 /**
4  *
5  * Some notes...
6  *
7  * Drupal docs don't list a bool type, but it might be nice to use rather than 'tinyint'
8  * Note however that we use bitfields and things as well in tinyints, and PG's
9  * "bool" type isn't 100% compatible with 0/1 checks. Just keeping tinyints. :)
10  *
11  * decimal <-> numeric
12  *
13  * MySQL 'timestamp' columns were formerly used for 'modified' files for their
14  * auto-updating properties. This didn't play well with changes to cache usage
15  * in 0.9.x, as we don't know the timestamp value at INSERT time and never
16  * have a chance to load it up again before caching. For now I'm leaving them
17  * in, but we may want to clean them up later.
18  *
19  * Current code should be setting 'created' and 'modified' fields explicitly;
20  * this also avoids mismatches between server and client timezone settings.
21  *
22  *
23  * fulltext indexes?
24  * got one or two things wanting a custom charset setting on a field?
25  *
26  * foreign keys are kinda funky...
27  *     those specified in inline syntax (as all in the original .sql) are NEVER ENFORCED on mysql
28  *     those made with an explicit 'foreign key' WITHIN INNODB and IF there's a proper index, do get enforced
29  *     double-check what we've been doing on postgres?
30  */
31
32 $classes = array('Schema_version',
33                  'Profile',
34                  'Avatar',
35                  'Sms_carrier',
36                  'User',
37                  'Subscription',
38                  'Group_join_queue',
39                  'Subscription_queue',
40                  'Oauth_token_association',
41                  'Notice',
42                  'Notice_location',
43                  'Notice_source',
44                  'Reply',
45                  'Consumer',
46                  'Token',
47                  'Nonce',
48                  'Oauth_application',
49                  'Oauth_application_user',
50                  'Confirm_address',
51                  'Remember_me',
52                  'Queue_item',
53                  'Notice_tag',
54                  'Foreign_service',
55                  'Foreign_user',
56                  'Foreign_link',
57                  'Foreign_subscription',
58                  'Invitation',
59                  'Profile_prefs',
60                  'Profile_tag',
61                  'Profile_list',
62                  'Profile_tag_subscription',
63                  'Profile_block',
64                  'User_group',
65                  'Related_group',
66                  'Group_inbox',
67                  'Group_member',
68                  'File',
69                  'File_redirection',
70                  'File_thumbnail',
71                  'File_to_post',
72                  'Group_block',
73                  'Group_alias',
74                  'Session',
75                  'Config',
76                  'Profile_role',
77                  'Location_namespace',
78                  'Login_token',
79                  'User_location_prefs',
80                  'User_im_prefs',
81                  'Conversation',
82                  'Local_group',
83                  'User_urlshortener_prefs',
84                  'Old_school_prefs',
85                  'User_username',
86                  'Attention',
87 );
88
89 foreach ($classes as $cls) {
90     $schema[strtolower($cls)] = call_user_func(array($cls, 'schemaDef'));
91 }