Class: HerokuSchemas::Drop
- Inherits:
-
SchemaCommand
- Object
- SchemaCommand
- HerokuSchemas::Drop
- Defined in:
- lib/heroku-schemas/drop.rb
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
Instance Method Summary collapse
-
#initialize(options) ⇒ Drop
constructor
A new instance of Drop.
- #perform ⇒ Object
Methods inherited from SchemaCommand
Constructor Details
#initialize(options) ⇒ Drop
Returns a new instance of Drop.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/heroku-schemas/drop.rb', line 5 def initialize() super() @string_reference = [:string_reference] raise 'Context app not provided' if @context_app.blank? raise 'Schema reference not provided' if @string_reference.blank? = [@context_app, @string_reference.split(':').first].uniq @schema = HerokuSchemas::SchemaReference.new(heroku: @heroku, string_reference: @context_app, related_apps: ) @database = HerokuSchemas::CurrentDatabase.connect_to_url(@schema.database_url) end |
Instance Attribute Details
#database ⇒ Object (readonly)
Returns the value of attribute database.
3 4 5 |
# File 'lib/heroku-schemas/drop.rb', line 3 def database @database end |
Instance Method Details
#perform ⇒ Object
17 18 19 20 |
# File 'lib/heroku-schemas/drop.rb', line 17 def perform @database.execute("DROP SCHEMA #{@schema.schema} CASCADE") write "Dropped schema #{@schema.database_app}:#{@schema.database_variable}:#{@schema.schema}" end |