Skip to content

Commit

Permalink
add unique indexes
Browse files Browse the repository at this point in the history
to keep things clean
  • Loading branch information
ccutrer committed Nov 21, 2013
1 parent 04424cd commit 346f091
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/tkellem/migrations/007_unique_indexes.rb
@@ -0,0 +1,14 @@
class UniqueIndexes < ActiveRecord::Migration
def self.up
add_index :listen_addresses, [:address, :port, :ssl], unique: true
add_index :users, :username, unique: true
add_index :networks, [:name, :user_id], unique: true
add_index :network_users, [:user_id, :network_id], unique: true
if SQLite3::SQLITE_VERSION >= '3.8.0.0'
execute("CREATE UNIQUE INDEX index_networks_on_name ON networks (name) WHERE user_id IS NULL")
end
add_index :settings, :name, unique: true
add_index :backlog_positions, [:network_user_id, :context_name, :device_name], unique: true, name: 'index_backlog_positions'
add_index :rooms, [:network_user_id, :name], unique: true
end
end

0 comments on commit 346f091

Please sign in to comment.