X Tutup
Skip to content

Commit eb68943

Browse files
committed
Add new migrations to dav app
New migrations have been added to the dav app to acheive the following: 1. Delete the existing entries in properties table which have null fileid entries 2. Restrict null value entry for fileid in properties table. Signed-off-by: Sujith H <sharidasan@owncloud.com>
1 parent 95e7aa0 commit eb68943

File tree

3 files changed

+79
-1
lines changed

3 files changed

+79
-1
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
/**
3+
* @author Sujith Haridasan <sharidasan@owncloud.com>
4+
*
5+
* @copyright Copyright (c) 2019, ownCloud GmbH
6+
* @license AGPL-3.0
7+
*
8+
* This code is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License, version 3,
10+
* as published by the Free Software Foundation.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Affero General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Affero General Public License, version 3,
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>
19+
*
20+
*/
21+
22+
namespace OCA\dav\Migrations;
23+
24+
use OCP\IDBConnection;
25+
use OCP\Migration\ISqlMigration;
26+
27+
/**
28+
* Remove null fileid's from the properties table.
29+
*/
30+
class Version20190822150226 implements ISqlMigration {
31+
32+
public function sql(IDBConnection $connection) {
33+
$qb = $connection->getQueryBuilder();
34+
$qb->delete('properties')
35+
->where($qb->expr()->isNull('fileid'));
36+
$qb->execute();
37+
}
38+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* @author Sujith Haridasan <sharidasan@owncloud.com>
4+
*
5+
* @copyright Copyright (c) 2019, ownCloud GmbH
6+
* @license AGPL-3.0
7+
*
8+
* This code is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License, version 3,
10+
* as published by the Free Software Foundation.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Affero General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Affero General Public License, version 3,
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>
19+
*
20+
*/
21+
22+
namespace OCA\dav\Migrations;
23+
24+
use Doctrine\DBAL\Schema\Schema;
25+
use OCP\Migration\ISchemaMigration;
26+
27+
/**
28+
* Add NULL constraint to fileid column for properties table.
29+
*/
30+
class Version20190823065724 implements ISchemaMigration {
31+
32+
public function changeSchema(Schema $schema, array $options) {
33+
$prefix = $options['tablePrefix'];
34+
35+
$table = $schema->getTable("${prefix}properties");
36+
$table->changeColumn('fileid', [
37+
'notnull' => true,
38+
]);
39+
}
40+
}

apps/dav/appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<description>ownCloud WebDAV endpoint</description>
66
<licence>AGPL</licence>
77
<author>owncloud.org</author>
8-
<version>0.4.0</version>
8+
<version>0.5.0</version>
99
<default_enable/>
1010
<use-migrations>true</use-migrations>
1111
<types>

0 commit comments

Comments
 (0)
X Tutup