Module: DynamicMigrations::Postgres::Generator::Schema

Included in:
DynamicMigrations::Postgres::Generator
Defined in:
lib/dynamic_migrations/postgres/generator/schema.rb

Instance Method Summary collapse

Instance Method Details

#create_schema(schema, code_comment = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/dynamic_migrations/postgres/generator/schema.rb', line 5

def create_schema schema, code_comment = nil
  # no table or schema name for this fragment (it is executed at the database level)
  add_fragment migration_method: :create_schema,
    object: schema,
    code_comment: code_comment,
    migration: "      create_schema :\#{schema.name}\n    RUBY\nend\n"

#drop_schema(schema, code_comment = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/dynamic_migrations/postgres/generator/schema.rb', line 15

def drop_schema schema, code_comment = nil
  # no table or schema name for this fragment (it is executed at the database level)
  add_fragment migration_method: :drop_schema,
    object: schema,
    code_comment: code_comment,
    migration: "      drop_schema :\#{schema.name}\n    RUBY\nend\n"