[Nitro] how to generate database constraints with og?

akonsu akonsu at gmail.com
Tue Oct 18 19:35:23 EDT 2005


unfortunately noone responded, so i had to read the code ;-). it seems
that to add constraints one needs to add

:sql_constrain '...'

to the class definition. is this true? (btw, is it possible to fix
this spelling error?) the problem is that my constraint uses a query
and in postgreSQL check constraints cannot have subqueries, so in my
constraint's expression i have to use an sql function that performs
this subquery.

is there a way in Og to create an SQL function? what is the general
way of doing something like this? do i have to manually tweak the
database after it s created during the fist Og run?


2005/10/17, akonsu <akonsu at gmail.com>:
> Hello,
> i am totally new to nitro and og, and i am working off the source code
> and without any documentation so far so please forgive my ignorance.
> my question is whether it is possible to generate constraints when
> creating a database from og objects. for example, the blog in
> examples-0.23.0 that i downloaded creates blog entries and comments
> tables and even these tables have primary keys but i did not see any
> foreign key constraints created. how to do that? also, is there a way
> to generate a general purpose CHECK constraints?
> thank you in advance
> konstantin

More information about the Nitro-general mailing list