Method: TestProf::AnyFixture::Dump::PostgreSQL#reset_sequence!

Defined in:
lib/test_prof/any_fixture/dump/postgresql.rb

#reset_sequence!(table_name, start) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/test_prof/any_fixture/dump/postgresql.rb', line 14

def reset_sequence!(table_name, start)
  _pk, sequence = conn.pk_and_sequence_for(table_name)
  return unless sequence

  sequence_name = "#{sequence.schema}.#{sequence.identifier}"

  execute "    ALTER SEQUENCE \#{sequence_name} RESTART WITH \#{start}; -- any_fixture:dump\n  SQL\nend\n"