Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Silverstripe creates only Indices but no Foreign Keys


Go to End


1105 Views

Avatar
seba.wagner

Community Member, 5 Posts

25 February 2013 at 2:28pm

I am using the PostgresSQL module for SilverStripe.

My issue is that I can define relations with for example:

public static $has_one = array(
'PageRedirect' => 'SiteTree',
);

What this will code do is that it will create the database with a Indice with the naming pattern: ix_tablename_pageredirectId
However no foreign key is created.

Further SilverStripe seems to write "0" instead of "null" in columns that are empty relations. So actually you can't even create those foreigh key contraints as SIlverStripe will constantly violate them.

How can one configure SilverStripe for proper Foreign Key Contraints in the database?

Thanks!
Sebastian