Skip to content

Decidim tries to install duplicate migrations #3388

@deivid-rodriguez

Description

@deivid-rodriguez

Describe the bug
When installing migrations on a new app, you get this warning.

NOTE: Migration 20171109132011_enable_pg_extensions.rb from decidim_initiatives has been skipped. Migration with the same name already exists

Indeed, there are two migrations with the same name (that also do the same thing):

$ fd enable_pg_extensions
decidim-initiatives/db/migrate/20171109132011_enable_pg_extensions.rb
decidim-proposals/db/migrate/20171212102250_enable_pg_extensions.rb
# frozen_string_literal: true

class EnablePgExtensions < ActiveRecord::Migration[5.1]
  def change
    enable_extension "pg_trgm"
  rescue ActiveRecord::CatchAll => e
    logger.error "Can not deal with pg_trgm extension: #{e}"
  end
end
# frozen_string_literal: true

class EnablePgExtensions < ActiveRecord::Migration[5.1]
  def change
    return if extension_enabled?("pg_trgm")

    begin
      # required so that test suite works in ci env
      enable_extension "pg_trgm"
    rescue StandardError
      raise <<-MSG.squish
        Decidim requires the pg_trgm extension to be enabled in your PostgreSQL.
        You can do so by running `CREATE EXTENSION IF NOT EXISTS "pg_trgm";` on the current DB as a PostgreSQL
        super user.
      MSG
    end
  end
end

This is unlikely to cause problems, but I guess we should probably either:

  • Choose one of them and move it to core.
  • Rename the migrations to not conflict with each other.

To Reproduce

  1. Run bundle exec rake development_app
  2. See error

Expected behavior
No warnings when installing decidim migrations.

Screenshots
None.

Stacktrace
None.

Extra data (please complete the following information):

  • Device: Not applicable.
  • Device OS: Any
  • Browser: Not applicable.
  • Decidim Version: master
  • Decidim installation: Any.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions