diff --git a/lib/scenic/adapters/postgres.rb b/lib/scenic/adapters/postgres.rb index 3fb69e0..161ee3f 100644 --- a/lib/scenic/adapters/postgres.rb +++ b/lib/scenic/adapters/postgres.rb @@ -177,9 +177,9 @@ def update_materialized_view(name, sql_definition, no_data: false, side_by_side: ) do create_materialized_view(new_name, sql_definition, no_data: no_data) end - rename_materialized_view(name, old_name) + rename_materialized_view(name, drop_name) rename_materialized_view(new_name, name) - drop_materialized_view(old_name) + drop_materialized_view(drop_name) else IndexReapplication.new(connection: connection).on(name) do drop_materialized_view(name) diff --git a/lib/scenic/adapters/postgres/indexes.rb b/lib/scenic/adapters/postgres/indexes.rb index 032f083..8578737 100644 --- a/lib/scenic/adapters/postgres/indexes.rb +++ b/lib/scenic/adapters/postgres/indexes.rb @@ -46,7 +46,7 @@ def index_from_database(result) object_name: result["object_name"], index_name: result["index_name"], definition: result["definition"], - schema_name: result["schema_name"], + schema_name: result["schema_name"] ) end end diff --git a/lib/scenic/index.rb b/lib/scenic/index.rb index 8d2f6de..36c3a03 100644 --- a/lib/scenic/index.rb +++ b/lib/scenic/index.rb @@ -44,10 +44,10 @@ def initialize(object_name:, index_name:, definition:, schema_name:) # @param object_name [String] The name of the object that has the index def with_other_object_name(object_name) type = if @definition.start_with? "CREATE UNIQUE" - "CREATE UNIQUE INDEX" - else - "CREATE INDEX" - end + "CREATE UNIQUE INDEX" + else + "CREATE INDEX" + end old_prefix = "#{type} #{@index_name} ON #{@schema_name}.#{@object_name}" new_prefix = "#{type} #{@index_name} ON #{@schema_name}.#{object_name}" unless @definition.start_with? old_prefix @@ -59,7 +59,7 @@ def with_other_object_name(object_name) object_name: object_name, index_name: @index_name, schema_name: @schema_name, - definition: tweaked_definition, + definition: tweaked_definition ) end end diff --git a/lib/scenic/statements.rb b/lib/scenic/statements.rb index 684d99b..8abede9 100644 --- a/lib/scenic/statements.rb +++ b/lib/scenic/statements.rb @@ -42,7 +42,7 @@ def create_view(name, version: nil, sql_definition: nil, materialized: false) Scenic.database.create_materialized_view( name, sql_definition, - no_data: hash_value_or_boolean(materialized, :no_data), + no_data: hash_value_or_boolean(materialized, :no_data) ) else Scenic.database.create_view(name, sql_definition) @@ -121,7 +121,7 @@ def update_view(name, version: nil, sql_definition: nil, revert_to_version: nil, name, sql_definition, no_data: hash_value_or_boolean(materialized, :no_data), - side_by_side: hash_value_or_boolean(materialized, :side_by_side), + side_by_side: hash_value_or_boolean(materialized, :side_by_side) ) else Scenic.database.update_view(name, sql_definition) diff --git a/spec/scenic/adapters/postgres_spec.rb b/spec/scenic/adapters/postgres_spec.rb index eb3b2a2..af22b35 100644 --- a/spec/scenic/adapters/postgres_spec.rb +++ b/spec/scenic/adapters/postgres_spec.rb @@ -109,7 +109,7 @@ module Adapters adapter.create_materialized_view( "greetings", - "SELECT text 'hi' AS greeting", + "SELECT text 'hi' AS greeting" ) adapter.rename_materialized_view("greetings", "hellos") diff --git a/spec/scenic/statements_spec.rb b/spec/scenic/statements_spec.rb index 84e2273..b62ed23 100644 --- a/spec/scenic/statements_spec.rb +++ b/spec/scenic/statements_spec.rb @@ -153,7 +153,7 @@ module Scenic connection.update_view( :name, version: 3, - materialized: { side_by_side: true }, + materialized: {side_by_side: true} ) expect(Scenic.database).to have_received(:update_materialized_view)