I''m not sure I completely understand the benefits of using ERBSQL or
how to use it. Google searches have proved it to be rather
undocumented.
From what I understand the embedded ruby sql allows you to write sql
that''s easier to deploy via the create_db script and also more
portable to postgres, myslq, or whatever.
But what I can''t find is a resource that explains the preset
constants or how to configure them if need be. For example the ERB
that comes with the saltedlogingenerator for rails looks like this:
CREATE TABLE users (
id <%= @pk %>,
login VARCHAR(80) NOT NULL,
salted_password VARCHAR(40) NOT NULL,
email VARCHAR(60) NOT NULL,
firstname VARCHAR(40) default NULL,
lastname VARCHAR(40) default NULL,
salt CHAR(40) NOT NULL,
verified INT default 0,
role VARCHAR(40) default NULL,
security_token CHAR(40) default NULL,
token_expiry <%= @datetime %> default NULL,
created_at <%= @datetime %> default NULL,
updated_at <%= @datetime %> default NULL,
logged_in_at <%= @datetime %> default NULL,
deleted INT default 0,
delete_after <%= @datetime %> default NULL
) <%= @options %>;
From viewing the example I get the gist of how it works and what''s
going on but what if I just want to make a date field instead of a
datetime etc. etc. Also what if I want to use a different set of
options for the table instead of the default ones generated by
create_db.
Finally, I am using the following sql to signify my foreign keys but
these statements create a syntax error when I run create_db:
constraint fk_pages_section foreign key (section_id) references
sections(id)
Any advice or links to a guide on working with erbsql? Also any
advice as to how to signify the foreign keys the erbsql way?
----------------------------------------
Jim Jeffers
"A trustworthy individual."
www.DontTrustThisGuy.com
(480) 235-5201
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails