adding PK to table encryption
adding auto increment/PK to table files_trash adding PK to table ldap_user_mapping and ldap_group_members adding PK to table ldap_group_mapping truncate permissions table to allow smooth creation of primary key adding unit test for creating an auto increment column on a table which already contains data remove unneeded table files_trashsizes fix unit test no need to truncate *PREFIX*permissions On Oracle adding auto increment columns is not working out of the box - Oracle migrations are to be done manually
This commit is contained in:
parent
c47d4ebbac
commit
fe8bae31dc
|
@ -13,6 +13,15 @@
|
||||||
|
|
||||||
<declaration>
|
<declaration>
|
||||||
|
|
||||||
|
<field>
|
||||||
|
<name>auto_id</name>
|
||||||
|
<type>integer</type>
|
||||||
|
<default>0</default>
|
||||||
|
<notnull>true</notnull>
|
||||||
|
<autoincrement>1</autoincrement>
|
||||||
|
<length>4</length>
|
||||||
|
</field>
|
||||||
|
|
||||||
<field>
|
<field>
|
||||||
<name>id</name>
|
<name>id</name>
|
||||||
<type>text</type>
|
<type>text</type>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.6
|
0.6.1
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
|
|
||||||
<index>
|
<index>
|
||||||
<name>owncloud_name_users</name>
|
<name>owncloud_name_users</name>
|
||||||
|
<primary>true</primary>
|
||||||
<unique>true</unique>
|
<unique>true</unique>
|
||||||
<field>
|
<field>
|
||||||
<name>owncloud_name</name>
|
<name>owncloud_name</name>
|
||||||
|
@ -90,6 +91,7 @@
|
||||||
<index>
|
<index>
|
||||||
<name>ldap_dn_groups</name>
|
<name>ldap_dn_groups</name>
|
||||||
<unique>true</unique>
|
<unique>true</unique>
|
||||||
|
<primary>true</primary>
|
||||||
<field>
|
<field>
|
||||||
<name>ldap_dn</name>
|
<name>ldap_dn</name>
|
||||||
</field>
|
</field>
|
||||||
|
@ -132,6 +134,7 @@
|
||||||
<index>
|
<index>
|
||||||
<name>ldap_group_members_index</name>
|
<name>ldap_group_members_index</name>
|
||||||
<unique>true</unique>
|
<unique>true</unique>
|
||||||
|
<primary>true</primary>
|
||||||
<field>
|
<field>
|
||||||
<name>owncloudname</name>
|
<name>owncloudname</name>
|
||||||
</field>
|
</field>
|
||||||
|
@ -141,4 +144,4 @@
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</database>
|
</database>
|
||||||
|
|
|
@ -109,7 +109,7 @@ class MDB2SchemaManager {
|
||||||
*/
|
*/
|
||||||
public function simulateUpdateDbFromStructure($file) {
|
public function simulateUpdateDbFromStructure($file) {
|
||||||
$toSchema = $this->readSchemaFromFile($file);
|
$toSchema = $this->readSchemaFromFile($file);
|
||||||
$migrator = $this->getMigrator()->checkMigrate($toSchema);
|
$this->getMigrator()->checkMigrate($toSchema);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,7 @@ class Updater extends BasicEmitter {
|
||||||
// This is added to prevent host header poisoning
|
// This is added to prevent host header poisoning
|
||||||
\OC_Config::setValue('trusted_domains', \OC_Config::getValue('trusted_domains', array(\OC_Request::serverHost())));
|
\OC_Config::setValue('trusted_domains', \OC_Config::getValue('trusted_domains', array(\OC_Request::serverHost())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* STOP CONFIG CHANGES FOR OLDER VERSIONS
|
* STOP CONFIG CHANGES FOR OLDER VERSIONS
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2014 Thomas Müller <deepdiver@owncloud.com>
|
||||||
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
|
* later.
|
||||||
|
* See the COPYING-README file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Test\DB;
|
||||||
|
|
||||||
|
class MDB2SchemaManager extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
|
public function tearDown() {
|
||||||
|
\OC_DB::dropTable('table');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAutoIncrement() {
|
||||||
|
|
||||||
|
if (\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite') === 'oci') {
|
||||||
|
$this->markTestSkipped('Adding auto increment columns in Oracle is not supported.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$connection = \OC_DB::getConnection();
|
||||||
|
$manager = new \OC\DB\MDB2SchemaManager($connection);
|
||||||
|
|
||||||
|
$manager->createDbFromStructure(__DIR__ . '/ts-autoincrement-before.xml');
|
||||||
|
$connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('abc'));
|
||||||
|
$connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('abc'));
|
||||||
|
$connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('123'));
|
||||||
|
$connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('123'));
|
||||||
|
$manager->updateDbFromStructure(__DIR__ . '/ts-autoincrement-after.xml');
|
||||||
|
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<database>
|
||||||
|
|
||||||
|
<name>*dbname*</name>
|
||||||
|
<create>true</create>
|
||||||
|
<overwrite>false</overwrite>
|
||||||
|
|
||||||
|
<charset>utf8</charset>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
|
||||||
|
<name>*dbprefix*table</name>
|
||||||
|
|
||||||
|
<declaration>
|
||||||
|
<field>
|
||||||
|
<name>auto_id</name>
|
||||||
|
<type>integer</type>
|
||||||
|
<default>0</default>
|
||||||
|
<notnull>true</notnull>
|
||||||
|
<autoincrement>1</autoincrement>
|
||||||
|
<length>4</length>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<name>textfield</name>
|
||||||
|
<type>text</type>
|
||||||
|
<default>foo</default>
|
||||||
|
<notnull>true</notnull>
|
||||||
|
<length>32</length>
|
||||||
|
</field>
|
||||||
|
</declaration>
|
||||||
|
</table>
|
||||||
|
</database>
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<database>
|
||||||
|
|
||||||
|
<name>*dbname*</name>
|
||||||
|
<create>true</create>
|
||||||
|
<overwrite>false</overwrite>
|
||||||
|
|
||||||
|
<charset>utf8</charset>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
|
||||||
|
<name>*dbprefix*table</name>
|
||||||
|
|
||||||
|
<declaration>
|
||||||
|
<field>
|
||||||
|
<name>textfield</name>
|
||||||
|
<type>text</type>
|
||||||
|
<default>foo</default>
|
||||||
|
<notnull>true</notnull>
|
||||||
|
<length>32</length>
|
||||||
|
</field>
|
||||||
|
</declaration>
|
||||||
|
</table>
|
||||||
|
</database>
|
Loading…
Reference in New Issue