Matt Good kirjoitti: > On Jun 10, 9:05 am, lidiriel <[EMAIL PROTECTED]> wrote: >> Hello, >> >> i create a new plugin and i would like add a foreign key in my new >> tables. But the api does'nt have ForeignKey object. >> How make it ? >> I think the solution of my problem is to execute a sql statement like >> "ALTER TABLE data_info ADD FOREIGN KEY (data_model_name) REFERENCES >> data_model(name)". > > Yes, you can run the SQL yourself if you plan to use this internally > on Postgres or MySQL only. However, Trac and most plugins don't use > explicit foreign key constraints since SQLite doesn't support them. > Referential integrity is managed in the Python code rather than in the > database.
Well to nitpick a bit, SQLite parses foreign key constraints but doesn't enforce them. So you still need to manage integrity in Python code. But Trac has very little of referential integrity so it shouldn't be much of a problem. -- Jani Tiainen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Development" 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/trac-dev?hl=en -~----------~----~----~----~------~----~------~--~---
