[DATABASE] Various table schema related fixes

This commit is contained in:
Alexei Sorokin
2019-09-11 12:07:54 +03:00
committed by Diogo Peralta Cordeiro
parent bc97f34f5a
commit 2b0251213f
21 changed files with 242 additions and 224 deletions

View File

@@ -81,11 +81,11 @@ class QnA_Answer extends Managed_DataObject
),
'primary key' => array('id'),
'unique keys' => array(
'question_uri_key' => array('uri'),
'question_id_profile_id_key' => array('question_id', 'profile_id'),
'qna_answer_uri_key' => array('uri'),
'qna_answer_question_id_profile_id_key' => array('question_id', 'profile_id'),
),
'indexes' => array(
'profile_id_question_id_index' => array('profile_id', 'question_id'),
'qna_answer_profile_id_question_id_idx' => array('profile_id', 'question_id'),
)
);
}

View File

@@ -77,7 +77,7 @@ class QnA_Question extends Managed_DataObject
),
'primary key' => array('id'),
'unique keys' => array(
'question_uri_key' => array('uri'),
'qna_question_uri_key' => array('uri'),
),
);
}

View File

@@ -1,46 +1,38 @@
<?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/>.
/**
* Data class to save users votes for
*
* PHP version 5
*
* @category QnA
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2011, StatusNet, Inc.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
* @category QnA
* @package GNUsocial
* @author Zach Copley <zach@status.net>
* @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
if (!defined('STATUSNET')) {
exit(1);
}
defined('GNUSOCIAL') || die();
/**
* For storing votes on question and answers
*
* @category QnA
* @package StatusNet
* @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
* @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*
* @see DB_DataObject
* @see DB_DataObject
*/
class QnA_Vote extends Managed_DataObject
{
@@ -87,11 +79,11 @@ class QnA_Vote extends Managed_DataObject
),
'primary key' => array('id'),
'indexes' => array(
'profile_id_question_Id_index' => array(
'qna_vote_profile_id_question_id_idx' => array(
'profile_id',
'question_id'
),
'profile_id_question_Id_index' => array(
'qna_vote_profile_id_question_id_idx' => array(
'profile_id',
'answer_id'
)
@@ -110,7 +102,7 @@ class QnA_Vote extends Managed_DataObject
*
* @return Void
*/
static function save($profile, $question, $answer, $vote)
public static function save($profile, $question, $answer, $vote)
{
$v = new QnA_Vote();
$v->id = UUID::gen();