Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'refinery_settings' already exists #486

Open
thebravoman opened this issue May 9, 2018 · 2 comments
Open

'refinery_settings' already exists #486

thebravoman opened this issue May 9, 2018 · 2 comments

Comments

@thebravoman
Copy link

I am using refinery for some time now and I've added refinerycms-blog.

Problem is the on

rake db:migrate

the following happens

StandardError: An error has occurred, this and all later migrations canceled:

PG::DuplicateTable: ERROR:  relation "refinery_settings" already exists
: CREATE TABLE "refinery_settings" ("id" serial NOT NULL PRIMARY KEY, "name" character varying, "value" text, "destroyable" boolean DEFAULT 't', "scoping" character varying, "restricted" boolean DEFAULT 'f', "form_value_type" character varying, "created_at" timestamp, "updated_at" timestamp)

Should there be a check if refinery_settings already exists?

@thebravoman
Copy link
Author

I had to modify

    unless ActiveRecord::Base.connection.table_exists? 'refinery_settings'
      create_table :refinery_settings do |t|
        t.string    :name
        t.text      :value
        t.boolean   :destroyable,             :default => true
        t.string    :scoping
        t.boolean   :restricted,              :default => false
        t.string    :form_value_type

        t.timestamps
      end

      add_index :refinery_settings, :name
    end
# This migration comes from refinery_settings (originally 20130414130143)
class AddSlugToRefinerySettings < ActiveRecord::Migration[4.2]
  def change
  	unless ActiveRecord::Base.connection.column_exists?(:refinery_settings, :slug)
	    add_column :refinery_settings, :slug, :string, :unique => true
	  end
  end
end
# This migration comes from refinery_settings (originally 20130422105953)
class AddTitleToRefinerySettings < ActiveRecord::Migration[4.2]
  def change
  	unless ActiveRecord::Base.connection.column_exists?(:refinery_settings, :title)
    	add_column :refinery_settings, :title, :string
   	end
  end
end

Should I get this into a PR? Comments if I am missing something here?

@bricesanchez
Copy link
Member

bricesanchez commented May 9, 2018

I don't think it's the things to do but i've seen this in refinerycms-blog:

rake("refinery_settings:install:migrations")

Perhaps we should add a constraint for this line.

Did you install refinerycms-settings before the blog?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants