The sqlite grammar does indeed support foreign keys, now. See
http://http://www.sqlite.org/foreignkeys.html
I've attached a patch that seems to do the right thing, although the pod
doesn't address this new functionality (or other current functionality,
apparently).
--- /home/zitz/Downloads/SQLite.pm 2010-11-11 11:51:58.085936002 -0600
+++ SQLite.pm 2010-11-11 11:42:32.215936002 -0600
@@ -433,6 +436,17 @@
on_conflict => $item[5][0],
}
}
+ |
+ FOREIGN_KEY parens_field_list REFERENCES ref_def
+ {
+ $return = {
+ supertype => 'constraint',
+ type => 'foreign_key',
+ fields => $item[2],
+ reference_table => $item[4]{'reference_table'},
+ reference_fields => $item[4]{'reference_fields'},
+ }
+ }
ref_def : /(\w+)\s*\((\w+)\)/
{ $return = { reference_table => $1, reference_fields => $2 } }
@@ -573,6 +587,8 @@
PRIMARY_KEY : /primary key/i
+FOREIGN_KEY : /foreign key/i
+
CHECK_C : /check/i
DEFAULT : /default/i