Module: Sequent::Test::DatabaseHelpers

Defined in:
lib/sequent/test/database_helpers.rb

Constant Summary collapse

ALLOWED_ENVS =
%w[development test spec].freeze

Class Method Summary collapse

Class Method Details

.maintain_test_database_schema(env: 'test') ⇒ Object

Utility method to let Sequent handle creation of sequent_schema and view_schema rather than using the available rake tasks.



11
12
13
14
15
16
# File 'lib/sequent/test/database_helpers.rb', line 11

def maintain_test_database_schema(env: 'test')
  fail ArgumentError, "env must one of [#{ALLOWED_ENVS.join(',')}] '#{env}'" unless ALLOWED_ENVS.include?(env)

  Migrations::SequentSchema.create_sequent_schema_if_not_exists(env: env, fail_if_exists: false)
  Migrations::ViewSchema.create_view_tables(env: env)
end