Decidim: Decidim tries to install duplicate migrations

Created on 10 May 2018  路  1Comment  路  Source: decidim/decidim

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.
WIP developer-experience enhancement

Most helpful comment

I'd rename the migrations, then. While it's true we consider decidim as a bundle, and as such you'll always have both migrations, this extension is a dependency of each component, so I think each component should be aware of it.

Thoughts @decidim/developers ?

>All comments

I'd rename the migrations, then. While it's true we consider decidim as a bundle, and as such you'll always have both migrations, this extension is a dependency of each component, so I think each component should be aware of it.

Thoughts @decidim/developers ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Xfolchf picture Xfolchf  路  3Comments

andreslucena picture andreslucena  路  4Comments

mrcasals picture mrcasals  路  4Comments

will94290 picture will94290  路  3Comments

andreslucena picture andreslucena  路  4Comments