From bc97f34f5a6d12c3812e646b45d3ed56d665639c Mon Sep 17 00:00:00 2001 From: Alexei Sorokin Date: Wed, 11 Sep 2019 11:56:36 +0300 Subject: [PATCH] [DATABASE] Re-order tables to be created Foreign keys need to be created after the respective tables are already in place. This order makes sure this is the case. --- db/core.php | 133 +++++++++++++++++++++++++++++----------------------- 1 file changed, 75 insertions(+), 58 deletions(-) diff --git a/db/core.php b/db/core.php index 171a21cd0b..958ace0bbf 100644 --- a/db/core.php +++ b/db/core.php @@ -1,4 +1,18 @@ . /** * @@ -25,64 +39,67 @@ * double-check what we've been doing on postgres? */ -$classes = array('Schema_version', - 'Profile', - 'Avatar', - 'Sms_carrier', - 'User', - 'Subscription', - 'Group_join_queue', - 'Subscription_queue', - 'Oauth_token_association', - 'Notice', - 'Notice_location', - 'Notice_source', - 'Notice_prefs', - 'Reply', - 'Consumer', - 'Token', - 'Nonce', - 'Oauth_application', - 'Oauth_application_user', - 'Confirm_address', - 'Remember_me', - 'Queue_item', - 'Notice_tag', - 'Foreign_service', - 'Foreign_user', - 'Foreign_link', - 'Foreign_subscription', - 'Invitation', - 'Profile_prefs', - 'Profile_tag', - 'Profile_list', - 'Profile_tag_subscription', - 'Profile_block', - 'User_group', - 'Related_group', - 'Group_inbox', - 'Group_member', - 'File', - 'File_redirection', - 'File_thumbnail', - 'File_to_post', - 'Group_block', - 'Group_alias', - 'Session', - 'Config', - 'Profile_role', - 'Location_namespace', - 'Login_token', - 'User_location_prefs', - 'User_im_prefs', - 'Conversation', - 'Local_group', - 'User_urlshortener_prefs', - 'Old_school_prefs', - 'User_username', - 'Attention', -); +defined('GNUSOCIAL') || die(); + +$classes = [ + 'Schema_version', + 'Profile', + 'Avatar', + 'Sms_carrier', + 'User', + 'User_group', + 'Subscription', + 'Group_join_queue', + 'Subscription_queue', + 'Consumer', + 'Oauth_application', + 'Oauth_token_association', + 'Conversation', + 'Notice', + 'Notice_location', + 'Notice_source', + 'Notice_prefs', + 'Reply', + 'Token', + 'Nonce', + 'Oauth_application_user', + 'Confirm_address', + 'Remember_me', + 'Queue_item', + 'Notice_tag', + 'Foreign_service', + 'Foreign_user', + 'Foreign_link', + 'Foreign_subscription', + 'Invitation', + 'Profile_prefs', + 'Profile_list', + 'Profile_tag', + 'Profile_tag_subscription', + 'Profile_block', + 'Related_group', + 'Group_inbox', + 'Group_member', + 'File', + 'File_redirection', + 'File_thumbnail', + 'File_to_post', + 'Group_block', + 'Group_alias', + 'Session', + 'Config', + 'Profile_role', + 'Location_namespace', + 'Login_token', + 'User_location_prefs', + 'User_im_prefs', + 'Local_group', + 'User_urlshortener_prefs', + 'Old_school_prefs', + 'User_username', + 'Attention' +]; foreach ($classes as $cls) { - $schema[strtolower($cls)] = call_user_func(array($cls, 'schemaDef')); + $schema[strtolower($cls)] = call_user_func([$cls, 'schemaDef']); }