Project

General

Profile

db tables not created when installing ezFAQ

Added by Patrick N almost 16 years ago

I have just tried installing ezFAQ, the install itself went fine but when I try to access the FAQ page I get an Internal Error. Looking at the log I see the ezFAQ tables have not been created in the database. I have run db:migrate (twice) but still nothing no tables. Is there someway I can create the tables manually, I noticed the migration file but as I have very little Ruby knowledge I wasn't sure whether I could just run this file.

Thanks.


Replies (6)

RE: db tables not created when installing ezFAQ - Added by Jean-Baptiste Barth almost 16 years ago

Did you follow this page : http://www.redmine.org/wiki/1/PluginEzfaq ?
Did you run "rake db:migrate_plugins" (and not "rake db:migrate") ?

RE: db tables not created when installing ezFAQ - Added by Patrick N almost 16 years ago

That was it, I was following that page but like you guessed, was running rake db:migrate and not rake db:migrate_plugins. All seems to work fine now, thanks for your help.

RE: db tables not created when installing ezFAQ - Added by Luca Vagnozzi almost 16 years ago

Hi I got an error while trying to migrate the plugin using rake db:migrate_plugins.

Running rake db:migrate_plugins --trace gives the error below:

Migrating ezfaq_plugin...
==  EzfaqSetup: migrating =====================================================
-- create_table("faq_categories", {:force=>true})
   -> 0.0199s
-- add_index("faq_categories", ["project_id"], {:name=>"faq_categories_project_id"})
   -> 0.0066s
-- create_table("faqs", {:force=>true})
   -> 0.0081s
-- add_index("faqs", ["project_id"], {:name=>"faqs_project_id"})
   -> 0.0123s
rake aborted!
An error has occurred, all later migrations canceled:

Object is not missing constant Faq!
/usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:419:in `load_missing_constant'
[CUT]

RE: db tables not created when installing ezFAQ - Added by Luca Vagnozzi over 15 years ago

I've solved this as below. It works but I don't know if it's correct, I'm new to ruby.

diff --git a/app/controllers/ezfaq_controller.rb b/app/controllers/ezfaq_controller.rb
index f70a1d5..376f134 100644
--- a/app/controllers/ezfaq_controller.rb
+++ b/app/controllers/ezfaq_controller.rb
@@ -15,6 +15,8 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

+require 'faq'
+
 class EzfaqController < ApplicationController
   unloadable

diff --git a/app/models/faq.rb b/app/models/faq.rb
index cf0eb36..6613cb7 100644
--- a/app/models/faq.rb
+++ b/app/models/faq.rb
@@ -1,6 +1,6 @@
 class Faq < ActiveRecord::Base
   set_locking_column :version
-  include GLoc
+  #include GLoc

   belongs_to :category, :class_name => 'FaqCategory', :foreign_key => 'category_id'
   belongs_to :project
diff --git a/db/migrate/001_ezfaq_setup.rb b/db/migrate/001_ezfaq_setup.rb
index 8961f38..ff01caf 100644
--- a/db/migrate/001_ezfaq_setup.rb
+++ b/db/migrate/001_ezfaq_setup.rb
@@ -1,5 +1,6 @@
 # ezFAQ plugin migration
 # Use rake db:migrate_plugins to migrate installed plugins
+require 'faq'
 class EzfaqSetup < ActiveRecord::Migration
   def self.up
     create_table "faq_categories", :force => true do |t|

RE: db tables not created when installing ezFAQ - Added by Denis Tomashenko over 15 years ago

Eric Davis, thank you!

Rails 2.2.x and Plugin migration changes
http://www.redmine.org/boards/3/topics/show/4361

This works.
After that, no errors in the migration plugins.

    (1-6/6)