Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Tretyakov committed Oct 18, 2009
1 parent ee14469 commit 026cb1b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.textile
Expand Up @@ -4,9 +4,13 @@ This is timesaver for middle/large Rails application which used PostgreSQL as da
Create/drop Views, Functions, Triggers, Foreign keys in your migrations using ruby syntax.

h2. Installation
<pre>script/plugin install git://github.com/alex3t/rails_on_pg.git</pre>

<pre>
script/plugin install git://github.com/alex3t/rails_on_pg.git
</pre>

h2. Views

<pre>
create_view :active_patients do |view|
view.select 'p.patient_id as id' ,'p.id as visit_id'
Expand All @@ -17,18 +21,23 @@ h2. Views
</pre>

h2. Functions

<pre>
create_function 'format_name', {:returns=>'character varying'}, 'first_name character varying(125)', 'middle_name character varying(15)', "last_name character varying(20)" do
"RETURN COALESCE(last_name, 'no last name') || ', ' || COALESCE(first_name, 'no first name');"
end
</pre>

h2. Triggers

<pre>
create_trigger "update_status", :before, "users", "insert","update"
#update status function body here
end
</pre>

h2. Foreign keys

<pre>
add_foreign_key :order_items, :product_id, :orders, :on_delete=>""
</pre>
Expand All @@ -37,6 +46,7 @@ For more details see rdoc or tests


h3. Todo

Make as gem


Expand Down

0 comments on commit 026cb1b

Please sign in to comment.