Class: Osmer::Schema::Custom
Defined Under Namespace
Instance Attribute Summary collapse
-
#source ⇒ Object
Returns the value of attribute source.
-
#tables ⇒ Object
readonly
Returns the value of attribute tables.
Attributes inherited from Base
Instance Method Summary collapse
- #create!(db) ⇒ Object
- #drop!(db) ⇒ Object
- #dsl ⇒ Object
-
#initialize(*args) ⇒ Custom
constructor
A new instance of Custom.
Methods inherited from Base
#attach_listener!, #detach_listener!, #recreate!, #table_prefix
Methods included from Configurable
Constructor Details
#initialize(*args) ⇒ Custom
Returns a new instance of Custom.
8 9 10 11 |
# File 'lib/osmer/schema/custom.rb', line 8 def initialize(*args) @tables = [] super end |
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
6 7 8 |
# File 'lib/osmer/schema/custom.rb', line 6 def source @source end |
#tables ⇒ Object (readonly)
Returns the value of attribute tables.
5 6 7 |
# File 'lib/osmer/schema/custom.rb', line 5 def tables @tables end |
Instance Method Details
#create!(db) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/osmer/schema/custom.rb', line 17 def create!(db) db.in_transaction do |conn| tables.each do |table| create_table! db, conn, table end end end |
#drop!(db) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/osmer/schema/custom.rb', line 25 def drop!(db) db.in_transaction do |conn| tables.reverse.each do |table| drop_table! db, conn, table end end end |