Kill trailing whitespace in ruby files
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class CreateFavorites < ActiveRecord::Migration
|
||||
TABLE_COUNT = 100
|
||||
|
||||
|
||||
def self.up
|
||||
# this is a dummy table and should not be used
|
||||
create_table "favorites" do |t|
|
||||
@@ -14,20 +14,20 @@ class CreateFavorites < ActiveRecord::Migration
|
||||
check (user_id % 100 = #{i})
|
||||
) inherits (favorites)
|
||||
EOS
|
||||
|
||||
|
||||
add_index "favorites_#{i}", :user_id
|
||||
add_index "favorites_#{i}", :post_id
|
||||
end
|
||||
|
||||
|
||||
fragment = []
|
||||
|
||||
|
||||
1.upto(TABLE_COUNT - 1) do |i|
|
||||
fragment << <<-EOS
|
||||
elsif (NEW.user_id % 100 = #{i}) then
|
||||
insert into favorites_#{i} values (NEW.*);
|
||||
EOS
|
||||
end
|
||||
|
||||
|
||||
execute <<-EOS
|
||||
create or replace function favorites_insert_trigger()
|
||||
returns trigger as $$
|
||||
@@ -41,7 +41,7 @@ class CreateFavorites < ActiveRecord::Migration
|
||||
$$
|
||||
language plpgsql
|
||||
EOS
|
||||
|
||||
|
||||
execute <<-EOS
|
||||
create trigger insert_favorites_trigger
|
||||
before insert on favorites
|
||||
@@ -51,7 +51,7 @@ class CreateFavorites < ActiveRecord::Migration
|
||||
|
||||
def self.down
|
||||
drop_table "favorites"
|
||||
|
||||
|
||||
0.upto(TABLE_COUNT - 1) do |i|
|
||||
drop_table "favorites_#{i}"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user