Module: IdRandomizer

Defined in:
lib/id_randomizer.rb,
lib/id_randomizer/version.rb,
lib/id_randomizer/postgresql.rb

Defined Under Namespace

Modules: PostgreSQL

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Class Method Details

.randomize_ids(except: []) ⇒ Object

Randomize ids/start sequences from all tables found in a given database except the blacklisted ones.



9
10
11
12
13
14
15
16
# File 'lib/id_randomizer.rb', line 9

def self.randomize_ids(except: [])
  case ActiveRecord::Base.connection
  when ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
    PostgreSQL.randomize_ids(except)
  else
    raise 'Database adapter not supported.'
  end
end