Skip to content

Commit

Permalink
0.18.3
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
  • Loading branch information
ArtificialOwl committed Feb 17, 2020
1 parent c4eda06 commit 712cae7
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 74 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
All notable changes to this project will be documented in this file.


### 0.18.2
### 0.18.3

- fixing issue during migration.

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package_name=$(app_name)
cert_dir=$(HOME)/.nextcloud/certificates
github_account=nextcloud
branch=master
version+=0.18.2
version+=0.18.3

all: appstore

Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Users won't be able to find this Circle using Nextcloud search engine.
]]>
</description>
<version>0.18.2</version>
<version>0.18.3</version>
<licence>agpl</licence>
<author>Maxence Lange</author>
<documentation>
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/MembersRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ public function forceGetHigherLevelGroupFromUser($circleUniqueId, $userId) {
public function createMember(Member $member) {

if ($member->getMemberId() === '') {
$member->setMemberId($this->token());
$member->setMemberId($this->token(14));
}

try {
Expand Down
162 changes: 93 additions & 69 deletions lib/Migration/Version0017Date20200202112903.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,81 +73,93 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();

$table = $schema->createTable('circles_members');
$table->addColumn(
'circle_id', 'string', [
if ($schema->hasTable('circles_members')) {
$table = $schema->getTable('circles_members');
$table->changeColumn(
'instance', [
'default' => ''
]
);
} else {

$table = $schema->createTable('circles_members');
$table->addColumn(
'circle_id', 'string', [
'notnull' => true,
'length' => 64,
]
);
$table->addColumn(
'user_id', 'string', [
'notnull' => true,
'length' => 128,
]
);
$table->addColumn(
'instance', 'string', [
'notnull' => false,
'default' => '',
'length' => 255,
]
);
$table->addColumn(
'user_type', 'smallint', [
'notnull' => true,
'length' => 1,
'default' => 1,
]
);
$table->addColumn(
'level', 'smallint', [
'notnull' => true,
'length' => 64,
'length' => 1,
]
);
$table->addColumn(
'user_id', 'string', [
'notnull' => true,
'length' => 128,
]
);
$table->addColumn(
'instance', 'string', [
);
$table->addColumn(
'status', 'string', [
'notnull' => false,
'length' => 15,
]
);
$table->addColumn(
'note', 'string', [
'notnull' => false,
'length' => 255,
]
);
$table->addColumn(
'user_type', 'smallint', [
'notnull' => true,
'length' => 1,
'default' => 1,
]
);
$table->addColumn(
'level', 'smallint', [
'notnull' => true,
'length' => 1,
]
);
$table->addColumn(
'status', 'string', [
'notnull' => false,
'length' => 15,
]
);
$table->addColumn(
'note', 'string', [
'notnull' => false,
'length' => 255,
]
);
$table->addColumn(
'joined', 'datetime', [
'notnull' => false,
]
);
$table->addColumn(
'member_id', Type::STRING, [
'notnull' => false,
'length' => 15,
]
);
$table->addColumn(
'contact_meta', 'string', [
'notnull' => false,
'length' => 1000,
]
);
$table->addColumn(
'contact_checked', Type::SMALLINT, [
'notnull' => false,
'length' => 1,
]
);
$table->addColumn(
'contact_id', 'string', [
);
$table->addColumn(
'joined', 'datetime', [
'notnull' => false,
'length' => 127,
]
);
);
$table->addColumn(
'member_id', Type::STRING, [
'notnull' => false,
'length' => 15,
]
);
$table->addColumn(
'contact_meta', 'string', [
'notnull' => false,
'length' => 1000,
]
);
$table->addColumn(
'contact_checked', Type::SMALLINT, [
'notnull' => false,
'length' => 1,
]
);
$table->addColumn(
'contact_id', 'string', [
'notnull' => false,
'length' => 127,
]
);

$table->setPrimaryKey(['circle_id', 'user_id', 'user_type', 'contact_id', 'instance']);
}

$table->setPrimaryKey(['circle_id', 'user_id', 'user_type', 'contact_id', 'instance']);

return $schema;
}
Expand All @@ -158,7 +170,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
* @param array $options
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
$this->copyTable('circles_mb_tmp', 'circles_members');
$this->copyTable('circles_mb_tmp', 'circles_members', ['instance' => '', 'contact_id' => '']);

$this->updateMemberId();
$this->updateTokens();
Expand Down Expand Up @@ -236,7 +248,12 @@ private function updateTokens() {
}


protected function copyTable($orig, $dest) {
/**
* @param $orig
* @param $dest
* @param array $default
*/
protected function copyTable($orig, $dest, array $default = []) {
$connection = \OC::$server->getDatabaseConnection();
$qb = $connection->getQueryBuilder();

Expand All @@ -254,6 +271,13 @@ protected function copyTable($orig, $dest) {
$copy->setValue($k, $copy->createNamedParameter($row[$k]));
}
}

$ak = array_keys($default);
foreach($ak as $k) {
// if (!array_key_exists($k, $row)) {
$copy->setValue($k, $copy->createNamedParameter($default[$k]));
// }
}
$copy->execute();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Migration/Version0017Date20200214112607.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
$table = $schema->getTable('circles_members');
$table->changeColumn(
'instance', [
'default' => '0',
'default' => '',
]
);

Expand Down

0 comments on commit 712cae7

Please sign in to comment.