Merge branch 'v1.2-dev' of https://github.com/humhub/humhub into v1.2-dev

This commit is contained in:
buddh4 2017-02-03 15:32:45 +01:00
commit 945f045e7b
7 changed files with 39 additions and 69 deletions

View File

@ -226,7 +226,7 @@ $config = [
'tour' => [
'acceptableNames' => ['interface', 'administration', 'profile', 'spaces']
],
'enablePjax' => false,
'enablePjax' => true,
]
];

View File

@ -7,15 +7,11 @@ class m160205_205540_foreign_keys extends Migration
{
public function up()
{
$this->addForeignKey('fk_content-user_id', 'content', 'user_id', 'user', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_wall_entry-wall_id', 'wall_entry', 'wall_id', 'wall', 'id', 'CASCADE', 'CASCADE');
}
public function down()
{
//echo "m160205_205540_foreign_keys cannot be reverted.\n";
$this->dropForeignKey('fk_content-user_id', 'content');
$this->dropForeignKey('fk_wall_entry-wall_id', 'wall');
return true;
}

View File

@ -8,37 +8,44 @@ class m160415_180332_wall_remove extends Migration
public function up()
{
$this->addColumn('content', 'show_in_stream', $this->boolean()->defaultValue(true));
$this->addColumn('content', 'stream_sort_date', $this->dateTime());
/**
* Allow restart of this migration
*/
try {
$this->addColumn('content', 'show_in_stream', $this->boolean()->defaultValue(true));
$this->addColumn('content', 'stream_sort_date', $this->dateTime());
} catch (Exception $ex) {
}
/**
* Populate stream_updated_at attribute
*/
$this->update('content', [
'stream_sort_date' => new Expression('(SELECT updated_at FROM wall_entry WHERE wall_entry.content_id=content.id LIMIT 1)')
], [
'IS', 'stream_sort_date', new Expression('NULL')
]);
/*
$this->db->createCommand('UPDATE content LEFT JOIN wall_entry ON wall_entry.content_id=content.id
SET content.stream_sort_date=wall_entry.updated_at
WHERE content.stream_sort_date IS NULL')->excute();
*/
$this->update('content', ['stream_sort_date' => new Expression('created_at')], ['IS', 'stream_sort_date', new Expression('NULL')]);
/**
* Populate show_in_stream attribute
*/
$this->update('content', [
'show_in_stream' => 0
], [
'IS', new Expression('(SELECT wall_entry.id FROM wall_entry WHERE wall_entry.content_id=content.id LIMIT 1)'), new Expression('NULL')
]);
/*
$this->db->createCommand('UPDATE content LEFT JOIN wall_entry ON wall_entry.content_id=content.id
SET content.show_in_stream=0
WHERE wall_entry.id IS NULL')->excute();
*/
$this->dropForeignKey('fk_space-wall_id', 'space');
$this->dropForeignKey('fk_wall_entry-wall_id', 'wall_entry');
$this->dropColumn('user', 'wall_id');
$this->dropColumn('space', 'wall_id');
$this->dropColumn('contentcontainer', 'wall_id');
$this->dropTable('wall_entry');
$this->dropTable('wall');
}

View File

@ -5,10 +5,15 @@ use yii\db\Migration;
class m160205_203955_foreign_keys extends Migration
{
public function up()
{
$this->addForeignKey('fk_like-created_by', 'like', 'created_by', 'user', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_like-target_user_id', 'like', 'target_user_id', 'user', 'id', 'CASCADE', 'CASCADE');
try {
$this->addForeignKey('fk_like-created_by', 'like', 'created_by', 'user', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_like-target_user_id', 'like', 'target_user_id', 'user', 'id', 'CASCADE', 'CASCADE');
} catch (Exception $ex) {
}
}
public function down()
@ -20,13 +25,13 @@ class m160205_203955_foreign_keys extends Migration
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
public function safeDown()
{
}
*/
}

View File

@ -1,30 +0,0 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160205_203933_foreign_keys extends Migration
{
public function up()
{
$this->addForeignKey('fk_post-created_by', 'post', 'created_by', 'user', 'id', 'CASCADE', 'CASCADE');
}
public function down()
{
$this->dropForeignKey('fk_post-created_by', 'post');
return true;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -10,7 +10,6 @@ class m160205_203913_foreign_keys extends Migration
$this->addForeignKey('fk_space_membership-user_id', 'space_membership', 'user_id', 'user', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_space_membership-space_id', 'space_membership', 'space_id', 'space', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_space_module-space_id', 'space_module', 'space_id', 'space', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_space_setting-space_id', 'space_setting', 'space_id', 'space', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_space-wall_id', 'space', 'wall_id', 'wall', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_space_module-module_id', 'space_module', 'module_id', 'module_enabled', 'module_id', 'CASCADE', 'CASCADE');
}
@ -20,7 +19,6 @@ class m160205_203913_foreign_keys extends Migration
$this->dropForeignKey('fk_space_membership-user_id', 'space_membership');
$this->dropForeignKey('fk_space_membership-space_id', 'space_membership');
$this->dropForeignKey('fk_space_module-space_id', 'space_module');
$this->dropForeignKey('fk_space_setting-space_id', 'space_setting');
$this->dropForeignKey('fk_space-wall_id', 'space');
$this->dropForeignKey('fk_space_module-module_id', 'space_module');

View File

@ -9,15 +9,12 @@ class m160205_203840_foreign_keys extends Migration
{
$this->addForeignKey('fk_user_follow-user_id', 'user_follow', 'user_id', 'user', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_group-space_id', 'group', 'space_id', 'space', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_group_admin-user_id', 'group_admin', 'user_id', 'user', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_group_admin-group_id', 'group_admin', 'group_id', 'group', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_group_permission-group_id', 'group_permission', 'group_id', 'group', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_user_mentioning-user_id', 'user_mentioning', 'user_id', 'user', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_user_module-user_id', 'user_module', 'user_id', 'user', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_user_password-user_id', 'user_password', 'user_id', 'user', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_profile-user_id', 'profile', 'user_id', 'user', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_profile_field-profile_field_category_id', 'profile_field', 'profile_field_category_id', 'profile_field_category', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_user_setting-user_id', 'user_setting', 'user_id', 'user', 'id', 'CASCADE', 'CASCADE');
$this->addForeignKey('fk_user_http_session-user_id', 'user_http_session', 'user_id', 'user', 'id', 'CASCADE', 'CASCADE');
}
@ -25,15 +22,12 @@ class m160205_203840_foreign_keys extends Migration
{
$this->dropForeignKey('fk_follow-user_id', 'user_follow');
$this->dropForeignKey('fk_group-space_id', 'group');
$this->dropForeignKey('fk_group_admin-user_id', 'group_admin');
$this->dropForeignKey('fk_group_admin-group_id', 'group_admin');
$this->dropForeignKey('fk_group_permission-group_id', 'group_permission');
$this->dropForeignKey('fk_user_mentioning-user_id', 'user_mentioning');
$this->dropForeignKey('fk_user_module-user_id', 'user_module');
$this->dropForeignKey('fk_user_password-user_id', 'user_password');
$this->dropForeignKey('fk_profile-user_id', 'profile');
$this->dropForeignKey('fk_profile_field-profile_field_category_id', 'profile_field');
$this->dropForeignKey('fk_user_setting-user_id', 'user_setting');
return true;
}