[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.
This commit is contained in:
Alexei Sorokin 2019-09-11 11:56:36 +03:00 committed by Diogo Peralta Cordeiro
parent 3f17a0efea
commit bc97f34f5a

View File

@ -1,4 +1,18 @@
<?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
*
@ -25,24 +39,29 @@
* double-check what we've been doing on postgres?
*/
$classes = array('Schema_version',
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',
'Consumer',
'Token',
'Nonce',
'Oauth_application',
'Oauth_application_user',
'Confirm_address',
'Remember_me',
@ -54,11 +73,10 @@ $classes = array('Schema_version',
'Foreign_subscription',
'Invitation',
'Profile_prefs',
'Profile_tag',
'Profile_list',
'Profile_tag',
'Profile_tag_subscription',
'Profile_block',
'User_group',
'Related_group',
'Group_inbox',
'Group_member',
@ -75,14 +93,13 @@ $classes = array('Schema_version',
'Login_token',
'User_location_prefs',
'User_im_prefs',
'Conversation',
'Local_group',
'User_urlshortener_prefs',
'Old_school_prefs',
'User_username',
'Attention',
);
'Attention'
];
foreach ($classes as $cls) {
$schema[strtolower($cls)] = call_user_func(array($cls, 'schemaDef'));
$schema[strtolower($cls)] = call_user_func([$cls, 'schemaDef']);
}