Project

General

Profile

Actions

Bug #12510

open

[API] Don't create an index if it exists already. Will break install if we manually added it,

Added by Nico César over 6 years ago. Updated 2 months ago.

Status:
New
Priority:
Normal
Assigned To:
-
Category:
-
Target version:
Story points:
-
Release:
Release relationship:
Auto

Description

if the index is already there, we should have some logic to avoid the upgrade of the package to fail. also in postgres we have different ways to doing depending on the version install
https://dba.stackexchange.com/questions/35616/create-index-if-it-does-not-exist

I'm referring to this:

services/api/db/migrate/20171027183824_add_index_to_containers.rb
class AddIndexToContainers < ActiveRecord::Migration
  def up
    ActiveRecord::Base.connection.execute("CREATE INDEX index_containers_on_modified_at_uuid ON containers USING btree (modified_at desc, uuid asc)")
    ActiveRecord::Base.connection.execute("CREATE INDEX index_container_requests_on_container_uuid on container_requests (container_uuid)")
  end

  def down
    ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_containers_on_modified_at_uuid")
    ActiveRecord::Base.connection.execute("DROP INDEX IF EXISTS index_container_requests_on_container_uuid")
  end
end

Actions #1

Updated by Tom Morris over 6 years ago

  • Subject changed from [API] don't create an index if it's there. will brake install if we manually added it, to [API] Don't create an index if it exists already. Will break install if we manually added it,
  • Target version set to Arvados Future Sprints

I'm not sure that having an index with the same name guarantees that it'll match the characteristics of the index in the migration script.

Also, adding special case code to handle manual workarounds smells bad to me.

Actions #2

Updated by Peter Amstutz almost 3 years ago

  • Target version deleted (Arvados Future Sprints)
Actions #3

Updated by Peter Amstutz about 1 year ago

  • Release set to 60
Actions #4

Updated by Peter Amstutz 2 months ago

  • Target version set to Future
Actions

Also available in: Atom PDF