First, yes, I now know I could build referential integrity constraints using Korma, and that's almost certainly what I shall do next time.
However, I'm quite a long way down building an app against a very tight deadline and I've declared my tables in clojure.java.jdbc, e.g. (defn create-categories-table "Reference data: award categories" [db-spec] (sql/with-connection db-spec (sql/create-table :categories [:id "serial primary key"] [:name "varchar(48)" "not null"]) (sql/do-commands "insert into categories (name) values ('Best Use of Ecommerce (UK market)')") (sql/do-commands "insert into categories (name) values ('Best Use of Ecommerce (International market)')") (sql/do-commands "insert into categories (name) values ('Ecommerce Innovation of the Year')") (sql/do-commands "insert into categories (name) values ('Ecommerce Newcomer of the Year')") (sql/do-commands "insert into categories (name) values ('Ecommerce Digital Agency of the Year')") (sql/do-commands "insert into categories (name) values ('Ecommerce Specialist Supplier of the Year')") )) (defn create-nominations-table "Actual nominations" [db-spec] (sql/with-connection db-spec (sql/create-table :nominations [:id "serial primary key"] [:firstname "varchar(64)" "not null"] [:surname "varchar(64)" "not null"] [:phone "varchar(24)" "not null"] [:email "varchar(128)" "not null"] [:business "varchar(64)" "not null"] [:category "integer" "not null"] [:url "varchar(256)" "not null"] [:contact "varchar(128)"] [:citation :text] ))) Obviously, 'category' in the nominations table should reference categories. And obviously, I can hack that in the database, so the fact that Clojure doesn't automatically set it up doesn't (this time) matter. However, I'd like to know for the future whether Korma is just the best way to go, or whether there is some database-independent[*] way to set up referential integrity constraints at the clojure.java.jdbc. [*] Yes, I know that the fact I'm using 'serial primary key' tells you already that I'm using Postgres, so this isn't database-independent! -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.