Skip to content

Instantly share code, notes, and snippets.

add_index :attachments, :parent_id
add_index :attachments, :asset_id
add_index :domain_names, :user_id
add_index :domain_names, :event_id
add_index :event_memberships, :user_id
add_index :event_memberships, :event_id
attachments: parent_id, asset_id
domain_names: organisation_id
event_memberships: user_id, event_id
events: editor_id
group_actions: user_id, group_id
groups: user_id
icons: parent_id
invitations: sender_id
legacy_actions: item_upon_id
news_items: author_id
@mothra
mothra / pre-commit
Last active December 15, 2015 05:19 — forked from bestie/pre-commit
#!/usr/bin/env ruby
# vim: set syntax=ruby
# Ensures that changes to the Rails schema.rb file may only be committed if a
# migration file is also committed at the same time.
# put this in .git/hooks/pre-commit
def schema_modified?
%x[ git diff --cached |grep schema.rb ] == ''
end
class IndexUsersEmails < ActiveRecord::Migration
def self.up
execute "END"
add_pg_index :users, :email, :lock => false
execute "BEGIN"
end
end