How would you handle updating an item and related stuff all at once?

Поиск
Список
Период
Сортировка
От Rick Schumeyer
Тема How would you handle updating an item and related stuff all at once?
Дата
Msg-id 45D6932E.9020706@ieee.org
обсуждение исходный текст
Ответы Re: How would you handle updating an item and related stuff all at once?  ("Adam Rich" <adam.r@sbcglobal.net>)
Re: How would you handle updating an item and related stuff all at once?  (Walter Vaughan <wvaughan@steelerubber.com>)
Re: How would you handle updating an item and related stuff all at once?  (Chris <dmagick@gmail.com>)
Re: How would you handle updating an item and related stuff all at once?  ("Ian Harding" <harding.ian@gmail.com>)
Список pgsql-general
This may be bad design on my part, but...

I have three tables of interest...Account, Employee, and
AccountEmployeeRelation.  There is a many-to-many relationship between
accounts and employees.  The join table also contains a column
indicating what role the employee plays on this account.

My interface is a web app (I'm trying out Ruby on Rails).  On the "edit
account" screen I want to edit account attributes AND be able to
add/delete employees in one form.  The gui part seems to work.

BUT, when I update I'm not sure how to handle updating the
AccountEmployeeRelation table.  During the update, relations may have
been added or deleted, and existing relations may have been changed.  It
seems to me the easiest thing to do is delete all the relations for the
account and create all new ones with the data submitted from the form.
This seems wasteful, but the alternative would be a pain.  Or is this
really the best way?

Thanks for any advice.

Completely off topic, (but not worth a separate post) I have been forced
to use a little bit of mysql lately...did you know that if you use
transaction and foreign key syntax with myisam tables, it does not
complain...it just silently ignores your requests for transactions and
foreign key checks.  Yikes!  I had incorrectly assumed I would get an
error message indicating that transactions are not supported.  Oh well.

В списке pgsql-general по дате отправления:

Предыдущее
От: Tatsuo Ishii
Дата:
Сообщение: Re: [ANNOUNCE] Advisory on possibly insecure security definer functions
Следующее
От: Toby Tremayne
Дата:
Сообщение: indexes across multiple tables