Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

readme

  • Loading branch information...
commit 026cb1b6bef2dc637d65b504081d3cd2faeda117 1 parent ee14469
Alexander Tretyakov authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 README.textile
12 README.textile
View
@@ -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'
@@ -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>
@@ -37,6 +46,7 @@ For more details see rdoc or tests
h3. Todo
+
Make as gem
Please sign in to comment.
Something went wrong with that request. Please try again.