Skip to content

Commit

Permalink
This one does not like standard
Browse files Browse the repository at this point in the history
  • Loading branch information
calebhearth committed Nov 20, 2024
1 parent 1f6a905 commit 8e9c5c4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lib/scenic/adapters/postgres.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/scenic/adapters/postgres/indexes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions lib/scenic/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/scenic/statements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion spec/scenic/adapters/postgres_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion spec/scenic/statements_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8e9c5c4

Please sign in to comment.