Hi,
we are new Elixir users and cope with problems while trying to delete
objects.
First of all, here is our schema definition:
class OfferArea(Entity):
has_field('id', Integer, primary_key=True)
has_field('area', Integer, required=True)
belongs_to('offer', of_kind='Offer', colname='offer_ref',
inverse='areas', ondelete="cascade", required=True, use_alter=True)
using_options(tablename='offer_area')
class Offer(Entity):
has_field('product_id', String(32), primary_key=True)
has_field('description', String, required=True)
has_field('user_type', Integer)
has_many('areas', of_kind='OfferArea')
using_options(tablename='offer')
We tried to use the cascading delete (ondelete="cascade") on
belongs_to argument. The create table statement is ok, but when trying
to delete the main object (Offer in our example), it doesn't proceed
to a cascading delete... Moreover Elixir tries to proceed with
"UPDATE ... SET ... [None]", while we want it simply deletes the
associated 'OfferArea' object.
With Mysql, when we delete an Offer object, it doesn't delete
associated OfferArea, but set 'offer_ref' to NULL.
--> Database lost its coherence (
With Postgresql, which correctly uses the "NOT NULL" constraint (due
to 'required=True), it crashes, because Elixir tried to set to null
'offer_ref' parameter of OfferArea.
Is there an parameter of "belongs_to" or "has_many" statement we did
not see?
We use 0.3.0 version of Elixir and tried it on Mysql (4.1) and
Postgresql (7.4).
Regards,
eTF_Team
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLElixir" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---