[Owncloud] Core db schema broken and unfixable without new installation

Daniel Danger owncloud at danger-it.de
Mon Mar 18 18:29:23 UTC 2013


Hi,

On 03/18/2013 07:05 PM, André Schild wrote:
> Am 18.03.2013 18:49, schrieb Bernhard Posselt:
>> On 03/18/2013 06:48 PM, Thomas Tanghus wrote:
>>> On Monday 18 March 2013 17:15 Bernhard Posselt wrote:
>>>> I've tried adding those fields and removing the primary key values from
>>>> the indices fields (why the fuck are they even in there!?)

Defining a primary key in the MDB2 Schema definition has some pitfalls.
quoting from
https://raw.github.com/pear/MDB2_Schema/master/docs/xml_schema_documentation.html
:
1) <autoincrement>: "Boolean flag property that specifies whether the
field should be an auto incrementing not null integer field with a
primary key."
2) <primary>: "Boolean flag property that specifies whether the
combination of the values of the index fields on each row of the table
should be a primary key."

Keep in mind, that the autoincrement tag is only defined within a
<field> declaration and the primary tag is only defined within a <index>
declaration.

>>>
>> Yeah but if the field that the index refers to is a primary key, then
>> so is the index. Or am i wrong?
> Some databases automatically create indexes for PK fields,
> for others you have to create a index for PK fields.

For all intends and purposes the primary key IS an index. So it makes
sense to define it as an index. (in some cases you need the primary key
to be composed of more than one field, in which case this is the only
way to define it).

> In a DB schema PK fields makes most sense when you then also use them in
> foreign keys, that way your data integrity
> is protected by the database.

Well, foreign keys are not used in owncloud. myisam doesn't support
them. And there are strong advocates for not dropping myisam support.

HTH
Daniel



More information about the Owncloud mailing list