Sven Klemm wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Josh,
I could change the primary key to no longer include the date so it
would work the way you had expected. Since the user interface allows
changing the date it should actually change the date and not create
new days.
Or you could just enable CASCADE.

CASCADE is already enabled. That's what I meant with foreign keys
being setup properly. This is a shortcoming of the HTML user
interface. The date is submitted as part of the form but when the date
changes the server does not know you tried to change it because it
looks like a new date to him. I could change the forms to include the
old date in a hidden field and check on the server if they are
identical so a change of the date would work. But removing the date
from the primary key would make this work without a change in
controller code, which is the lesser evil.

Instead of including the old date, include the primary key

pentabarf_pgcon=> \d conference_day
          Table "public.conference_day"
     Column     |  Type   |       Modifiers
----------------+---------+-----------------------
 conference_id  | integer | not null
 conference_day | date    | not null
 name           | text    |
 public         | boolean | not null default true

It seems to me that adding in a conference_day_id (serial) might help here. But I also seem to recall this may have been present in a previous version.

--
Dan Langille

BSDCan - The Technical BSD Conference : http://www.bsdcan.org/
PGCon  - The PostgreSQL Conference:     http://www.pgcon.org/
_______________________________________________
pentabarf mailing list
pentabarf@mail.skyhub.de
https://mail.skyhub.de/cgi-bin/mailman/listinfo/pentabarf

Reply via email to