upgrading existing schema, change foreign keys to 'on delete cascade'

29 views
Skip to first unread message

donald.tr...@gmail.com

unread,
Jan 13, 2018, 8:03:09 AM1/13/18
to redbeanphp
Hi,

When we started using RedbeanPHP we did not realize the importance of picking the proper construct ownXXXList vs. xownXXXList. We were using ownXXXList everywhere and now we would like to change our foreign keys from "on delete set null" to "on delete cascade". Is there something in ReadBeansPHP that we could use to achieve this on a schema that is already deployed?

Thanks,
Bill


gabor

unread,
Jan 14, 2018, 12:40:06 PM1/14/18
to redbeanphp


Hi there,

Unfortunately RedBeanPHP does not ship with a migration tool, but there are plenty of tools available to adjust or sync a database schema.

cheers
Gabor

rivets

unread,
Jan 15, 2018, 10:44:02 AM1/15/18
to redbeanphp

I don't think that was the intent of the question though. I read this as meaning that if you had created something by saying:

$bean->ownThing[] = $thing;

was there a way to later to add "on cascade delete" - like retrospectively saying

$bean->xownThing[] = $thing;

(which I guess does not work, though I have never tried it - I always just go in and set them by hand if I need to change the cascade properties or forgot to set them at the start, which is more likely :-) )

L.
Reply all
Reply to author
Forward
0 new messages