codevise / pageflow

Multimedia story telling for the web.
http://pageflow.io
MIT License
693 stars 126 forks source link

Table .users does not exists #292

Closed amo42 closed 9 years ago

amo42 commented 9 years ago

I try to install pageflow but could not finish installation.

I followed each step but can not run "rake db:migrate" it throws an mysql error, see below:

...
-- create_table("pageflow_video_files", {:force=>true})
   -> 0.0070s
== 20150508092950 SetupSchema: migrated (0.6840s) =============================

== 20150508092951 AddAttributesToUsers: migrating =============================
-- add_column(:users, :failed_attempts, :integer, {:default=>0})
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: Table 'storytelling_app01_development.users' doesn't exist: ALTER TABLE `users` ADD `failed_attempts` int(11) DEFAULT 0/usr/local/rvm/gems/ruby-2.0.0-p643/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:287:in `query'
/usr/local/rvm/gems/ruby-2.0.0-p643/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:287:in `block in execute'

I started look around within the migration files and did not find any "create table users" line. I also tryed to create this table manually with a random column name that I've deleted after migration "successfully". Then I run rake db:seed, started the app and try to log in, but I was not able to log in, there is not even a single user from the seed file possible to login - but app seams to run

Also tried to create a completely new app, starting up from beginning .. same result.

Can someone help me therefore? What did I wrong?

tf commented 9 years ago

Sounds like "Devise Migration without File Extension" from our trouble shooting guide. Did you apply the migration name fix as mentioned in the README?

amo42 commented 9 years ago

Thanks for your reply. Poorly I read this bug and i double checked this. But regarding to the linked page all migration files are ending with .rb

I found a hard workaround. I added the following to the mentioned file

create_table "users", force: true do |t|
    t.string "email",
end

after thats a add each missing column that throws an "column not exits" error manually to the table. Now I was able to login. Demo works, S3 bucket and Zencoder works as well but there is still an error browsing /admin/users:

Showing /home/storytelling/.bundler/ruby/1.9.1/active_admin-2385a54a15eb/app/views/active_admin/resource/index.html.arb where line #2 raised:

undefined method `name' for nil:NilClass
Extracted source (around line #2):

  insert_tag renderer_for(:index)

Rails.root: /home/storytelling/pageflow_applications/my_pageflow

I'm not sure if this comes by my manually "fix" for the users table but it will be much better if I'm able to mange users outside of the terminal :D

tf commented 9 years ago

Creating the user table manually like this will not work since you are missing all other columns.

So when you generate a new Rails app and run the pageflow:install generator, you do not get a db/migrate/xxxx-devise_create_users.rb file?

amo42 commented 9 years ago

Mhh thats confusing.. now it was created. run db:migrate and db:seed result:

undefined method `suspended_at?' for #<User:0x007f0ac9c1c2c8>

so now the columns are missing again and also the users table has no data sets.

tf commented 9 years ago

Could you post:

amo42 commented 9 years ago

Full stack trace:

activemodel (4.0.4) lib/active_model/attribute_methods.rb:439:in `method_missing'
activerecord (4.0.4) lib/active_record/attribute_methods.rb:167:in `method_missing'
pageflow (0.7.2) app/models/concerns/pageflow/suspendable.rb:8:in `suspended?'
pageflow (0.7.2) app/models/concerns/pageflow/suspendable.rb:4:in `active_for_authentication?'
devise (3.0.4) lib/devise/hooks/activatable.rb:6:in `block in <top (required)>'
warden (1.2.3) lib/warden/hooks.rb:14:in `call'
warden (1.2.3) lib/warden/hooks.rb:14:in `block in _run_callbacks'
warden (1.2.3) lib/warden/hooks.rb:9:in `each'
warden (1.2.3) lib/warden/hooks.rb:9:in `_run_callbacks'
warden (1.2.3) lib/warden/manager.rb:53:in `_run_callbacks'
warden (1.2.3) lib/warden/proxy.rb:179:in `set_user'
warden (1.2.3) lib/warden/proxy.rb:323:in `_perform_authentication'
warden (1.2.3) lib/warden/proxy.rb:104:in `authenticate'
devise (3.0.4) lib/devise/controllers/helpers.rb:56:in `current_user'
pageflow (0.7.2) lib/pageflow.rb:65:in `block in active_admin_settings'
activesupport (4.0.4) lib/active_support/callbacks.rb:427:in `_run__2566500680392199335__process_action__callbacks'
activesupport (4.0.4) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.4) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.4) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.4) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.4) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.4) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.4) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.4) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.0.4) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.4) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.4) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.4) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.4) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.4) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.4) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.0.4) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.4) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.4) lib/action_dispatch/routing/mapper.rb:44:in `call'
actionpack (4.0.4) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.4) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.4) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.4) lib/action_dispatch/routing/route_set.rb:674:in `call'
i18n-js (2.1.2) lib/i18n-js/middleware.rb:11:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.5.3) lib/rack/etag.rb:23:in `call'
rack (1.5.3) lib/rack/conditionalget.rb:35:in `call'
rack (1.5.3) lib/rack/head.rb:11:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.3) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.3) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.4) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
activerecord (4.0.4) lib/active_record/migration.rb:373:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.4) lib/active_support/callbacks.rb:373:in `_run__3769503861025972562__call__callbacks'
activesupport (4.0.4) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.4) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.4) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.4) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.0.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.0.4) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.0.4) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.0.4) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.3) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.3) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.4) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.3) lib/rack/lock.rb:17:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.3) lib/rack/sendfile.rb:112:in `call'
railties (4.0.4) lib/rails/engine.rb:511:in `call'
railties (4.0.4) lib/rails/application.rb:97:in `call'
rack (1.5.3) lib/rack/lock.rb:17:in `call'
rack (1.5.3) lib/rack/content_length.rb:14:in `call'
rack (1.5.3) lib/rack/handler/webrick.rb:60:in `service'
/usr/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/usr/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/usr/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

db/schema.rb:

storytelling@ip-172-31-32-5:~/pageflow_applications/my_pageflow$ cat db/schema.rb
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20150508115357) do

  create_table "active_admin_comments", force: true do |t|
    t.string   "namespace"
    t.text     "body"
    t.string   "resource_id",   null: false
    t.string   "resource_type", null: false
    t.integer  "author_id"
    t.string   "author_type"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id", using: :btree
  add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace", using: :btree
  add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id", using: :btree

  create_table "friendly_id_slugs", force: true do |t|
    t.string   "slug",                      null: false
    t.integer  "sluggable_id",              null: false
    t.string   "sluggable_type", limit: 50
    t.string   "scope"
    t.datetime "created_at"
  end

  add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree
  add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree
  add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree
  add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree

  create_table "pageflow_accounts", force: true do |t|
    t.string   "name",                default: "", null: false
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "default_file_rights", default: "", null: false
    t.string   "landing_page_name",   default: "", null: false
    t.integer  "default_theming_id"
  end

  add_index "pageflow_accounts", ["default_theming_id"], name: "index_pageflow_accounts_on_default_theming_id", using: :btree

  create_table "pageflow_accounts_themes", id: false, force: true do |t|
    t.integer "account_id"
    t.integer "theme_name"
  end

  create_table "pageflow_audio_files", force: true do |t|
    t.integer  "entry_id"
    t.integer  "uploader_id"
    t.string   "attachment_on_filesystem_file_name"
    t.string   "attachment_on_filesystem_content_type"
    t.integer  "attachment_on_filesystem_file_size",    limit: 8
    t.datetime "attachment_on_filesystem_updated_at"
    t.string   "attachment_on_s3_file_name"
    t.string   "attachment_on_s3_content_type"
    t.integer  "attachment_on_s3_file_size",            limit: 8
    t.datetime "attachment_on_s3_updated_at"
    t.integer  "job_id"
    t.string   "state"
    t.decimal  "encoding_progress",                               precision: 5, scale: 2
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "encoding_error_message"
    t.integer  "duration_in_ms"
    t.string   "format"
    t.string   "rights",                                                                  default: "", null: false
    t.integer  "confirmed_by_id"
  end

  create_table "pageflow_chapters", force: true do |t|
    t.integer  "entry_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "position",    default: 0,  null: false
    t.string   "title",       default: "", null: false
    t.integer  "revision_id"
  end

  add_index "pageflow_chapters", ["entry_id"], name: "index_pageflow_chapters_on_entry_id", using: :btree
  add_index "pageflow_chapters", ["revision_id"], name: "index_pageflow_chapters_on_revision_id", using: :btree

  create_table "pageflow_edit_locks", force: true do |t|
    t.integer  "user_id"
    t.integer  "entry_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "pageflow_edit_locks", ["entry_id"], name: "index_pageflow_edit_locks_on_entry_id", using: :btree
  add_index "pageflow_edit_locks", ["user_id"], name: "index_pageflow_edit_locks_on_user_id", using: :btree

  create_table "pageflow_entries", force: true do |t|
    t.string   "title",      default: "", null: false
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "slug",                    null: false
    t.integer  "account_id"
    t.integer  "folder_id"
    t.integer  "theming_id"
  end

  add_index "pageflow_entries", ["account_id"], name: "index_pageflow_entries_on_account_id", using: :btree
  add_index "pageflow_entries", ["folder_id"], name: "index_pageflow_entries_on_folder_id", using: :btree
  add_index "pageflow_entries", ["slug"], name: "index_pageflow_entries_on_slug", unique: true, using: :btree
  add_index "pageflow_entries", ["theming_id"], name: "index_pageflow_entries_on_theming_id", using: :btree

  create_table "pageflow_file_usages", force: true do |t|
    t.integer  "revision_id"
    t.integer  "file_id"
    t.string   "file_type"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "pageflow_file_usages", ["file_id", "file_type"], name: "index_pageflow_file_usages_on_file_id_and_file_type", using: :btree
  add_index "pageflow_file_usages", ["revision_id"], name: "index_pageflow_file_usages_on_revision_id", using: :btree

  create_table "pageflow_folders", force: true do |t|
    t.string   "name"
    t.integer  "account_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "pageflow_folders", ["account_id"], name: "index_pageflow_folders_on_account_id", using: :btree

  create_table "pageflow_image_files", force: true do |t|
    t.integer  "entry_id"
    t.integer  "uploader_id"
    t.string   "unprocessed_attachment_file_name"
    t.string   "unprocessed_attachment_content_type"
    t.integer  "unprocessed_attachment_file_size",    limit: 8
    t.datetime "unprocessed_attachment_updated_at"
    t.string   "processed_attachment_file_name"
    t.string   "processed_attachment_content_type"
    t.integer  "processed_attachment_file_size",      limit: 8
    t.datetime "processed_attachment_updated_at"
    t.string   "state"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "width"
    t.integer  "height"
    t.string   "rights",                                        default: "", null: false
  end

  create_table "pageflow_memberships", force: true do |t|
    t.integer  "user_id"
    t.integer  "entry_id"
    t.string   "name"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "pageflow_memberships", ["entry_id"], name: "index_pageflow_memberships_on_entry_id", using: :btree
  add_index "pageflow_memberships", ["user_id"], name: "index_pageflow_memberships_on_user_id", using: :btree

  create_table "pageflow_pages", force: true do |t|
    t.integer  "chapter_id"
    t.string   "template",              default: "",   null: false
    t.text     "configuration"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "position",              default: 0,    null: false
    t.boolean  "display_in_navigation", default: true
    t.integer  "perma_id"
  end

  add_index "pageflow_pages", ["chapter_id"], name: "index_pageflow_pages_on_chapter_id", using: :btree
  add_index "pageflow_pages", ["perma_id"], name: "index_pageflow_pages_on_perma_id", using: :btree

  create_table "pageflow_revisions", force: true do |t|
    t.integer  "entry_id"
    t.integer  "creator_id"
    t.datetime "published_at"
    t.datetime "published_until"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.text     "credits"
    t.string   "title",                       default: "",    null: false
    t.text     "summary"
    t.boolean  "manual_start",                default: false
    t.integer  "restored_from_id"
    t.datetime "frozen_at"
    t.string   "snapshot_type"
    t.string   "home_url",                    default: "",    null: false
    t.boolean  "home_button_enabled",         default: false, null: false
    t.boolean  "emphasize_chapter_beginning", default: false, null: false
    t.boolean  "emphasize_new_pages",         default: false, null: false
    t.integer  "share_image_id"
    t.integer  "share_image_x"
    t.integer  "share_image_y"
    t.string   "locale"
  end

  add_index "pageflow_revisions", ["restored_from_id"], name: "index_pageflow_revisions_on_restored_from_id", using: :btree

  create_table "pageflow_themings", force: true do |t|
    t.string   "imprint_link_url"
    t.string   "imprint_link_label"
    t.string   "copyright_link_url"
    t.string   "copyright_link_label"
    t.integer  "account_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "cname",                          default: "",   null: false
    t.string   "theme_name"
    t.string   "home_url",                       default: "",   null: false
    t.boolean  "home_button_enabled_by_default", default: true, null: false
  end

  add_index "pageflow_themings", ["cname"], name: "index_pageflow_themings_on_cname", using: :btree

  create_table "pageflow_video_files", force: true do |t|
    t.integer  "entry_id"
    t.integer  "uploader_id"
    t.string   "attachment_on_filesystem_file_name"
    t.string   "attachment_on_filesystem_content_type"
    t.integer  "attachment_on_filesystem_file_size",    limit: 8
    t.datetime "attachment_on_filesystem_updated_at"
    t.string   "attachment_on_s3_file_name"
    t.string   "attachment_on_s3_content_type"
    t.integer  "attachment_on_s3_file_size",            limit: 8
    t.datetime "attachment_on_s3_updated_at"
    t.integer  "job_id"
    t.string   "state"
    t.decimal  "encoding_progress",                               precision: 5, scale: 2
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "encoding_error_message"
    t.string   "thumbnail_file_name"
    t.integer  "width"
    t.integer  "height"
    t.integer  "duration_in_ms"
    t.string   "format"
    t.string   "poster_file_name"
    t.string   "poster_content_type"
    t.string   "thumbnail_content_type"
    t.string   "rights",                                                                  default: "", null: false
    t.integer  "confirmed_by_id"
  end

  create_table "pageflow_widgets", force: true do |t|
    t.integer  "subject_id"
    t.string   "subject_type"
    t.string   "type_name"
    t.string   "role"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "users", force: true do |t|
    t.string   "email",                  default: "", null: false
    t.string   "encrypted_password",     default: "", null: false
    t.string   "reset_password_token"
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.integer  "sign_in_count",          default: 0
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
    t.string   "current_sign_in_ip"
    t.string   "last_sign_in_ip"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
  add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree

  create_table "users_backup", force: true do |t|
    t.string   "email"
    t.string   "remember_created_at"
    t.string   "sign_in_count"
    t.string   "last_sign_in_ip"
    t.string   "current_sign_in_ip"
    t.string   "last_sign_in_at"
    t.string   "current_sign_in_at"
    t.string   "reset_password_sent_at"
    t.string   "reset_password_token"
    t.string   "encrypted_password"
    t.integer  "failed_attempts",        default: 0
    t.datetime "locked_at"
    t.string   "first_name"
    t.string   "last_name"
    t.string   "full_name"
    t.datetime "suspended_at"
    t.integer  "account_id"
    t.string   "role",                   default: "editor", null: false
    t.string   "locale"
  end

  add_index "users_backup", ["account_id"], name: "index_pageflow_users_on_account_id", using: :btree
  add_index "users_backup", ["email"], name: "index_pageflow_users_on_email", unique: true, using: :btree

end

db/migrate directory

drwxr-xr-x 2 storytelling storytellung 4096 May  8 16:08 ./
drwxr-xr-x 3 storytelling storytellung 4096 May  8 16:25 ../
-rw-r--r-- 1 storytelling storytellung  591 May  8 11:53 20150508115325_create_active_admin_comments.rb
-rw-r--r-- 1 storytelling storytellung 1482 May  8 11:53 20150508115330_devise_create_users.rb
-rw-r--r-- 1 storytelling storytellung  567 May  8 11:53 20150508115334_create_friendly_id_slugs.rb
-rw-r--r-- 1 storytelling storytellung 8967 May  8 11:59 20150508115341_setup_schema.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  694 May  8 16:08 20150508115342_add_attributes_to_users.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  401 May  8 11:53 20150508115343_create_themings.pageflow.rb
-rw-r--r-- 1 storytelling storytellung 1205 May  8 11:53 20150508115344_create_themings_for_existing_accounts.pageflow.rb
-rw-r--r-- 1 storytelling storytellung 1837 May  8 11:53 20150508115345_change_theme_references_to_theming_references.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  460 May  8 11:53 20150508115346_remove_attributes_from_themes.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  273 May  8 11:53 20150508115347_create_accounts_themes_join_table.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  904 May  8 11:53 20150508115348_move_cname_from_account_to_theming.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  510 May  8 11:53 20150508115349_drop_themes.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  259 May  8 11:53 20150508115350_add_confirmed_by_to_encoded_files.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  526 May  8 11:53 20150508115351_add_home_url_attributes_to_themings_and_revisions.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  298 May  8 11:53 20150508115352_create_widgets.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  264 May  8 11:53 20150508115353_add_emphasize_chapter_beginning_to_revisions.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  248 May  8 11:53 20150508115354_add_emphasize_new_pages_to_revisions.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  331 May  8 11:53 20150508115355_add_sharing_image_to_revisions.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  177 May  8 11:53 20150508115356_add_locale_to_users.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  194 May  8 11:53 20150508115357_add_locale_to_revisions.pageflow.rb
tf commented 9 years ago

Where does the users_backup table come from? Please use a newly created, empty database when running the generator.

amo42 commented 9 years ago

The user_backup table is my own table, that i was using to get pageflow working by adding each missing column until i was able to login. all databases were created by the generator at the first start

tf commented 9 years ago

The generator does not create databases. It's done with rake db:create call. Could you change the names of the databases in config/database.yml to something new, call rake db:create db:migrate again and tell me whether it produces any error.

Also could you paste the contents of the two migrations:

Trying to figure out what is going on here.

amo42 commented 9 years ago

Is it possible that you also can commit a sqldump of a users table containing some accounts like the seeder will contain?

I also tried to "recreate" all databases completely new which ends each time in the same results. I will try it one more time again maybe I make a mistake anywhere :(

But for now, thank you so much for your fast support :)

amo42 commented 9 years ago
storytelling@ip-172-31-32-5:~/pageflow_applications/my_pageflow$ mv db/migrate/20150508171727_add_devise_to_users db/migrate/20150508171727_add_devise_to_users.rb

then run db_migrate ends in error again:

storytelling@ip-172-31-32-5:~/pageflow_applications/my_pageflow$ rake db:migrate
== 20150508171722 CreateActiveAdminComments: migrating ========================
-- create_table(:active_admin_comments)
   -> 0.0068s
-- add_index(:active_admin_comments, [:namespace])
   -> 0.0268s
-- add_index(:active_admin_comments, [:author_type, :author_id])
   -> 0.0267s
-- add_index(:active_admin_comments, [:resource_type, :resource_id])
   -> 0.0278s
== 20150508171722 CreateActiveAdminComments: migrated (0.0887s) ===============

== 20150508171727 AddDeviseToUsers: migrating =================================
-- change_table(:users)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: Table 'my_pageflow_development_recreate.users' doesn't exist: ALTER TABLE `users` ADD `email` varchar(255) DEFAULT '' NOT NULL/var/lib/gems/1.9.1/gems/activerecord-4.0.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:287:in `query'

listing of db/migrate: create table user is still not there...

drwxr-xr-x 2 storytelling storytellung 4096 May  8 17:18 ./
drwxr-xr-x 3 storytelling storytellung 4096 May  8 17:17 ../
-rw-r--r-- 1 storytelling storytellung  591 May  8 17:17 20150508171722_create_active_admin_comments.rb
-rw-r--r-- 1 storytelling storytellung 1837 May  8 17:17 20150508171727_add_devise_to_users.rb
-rw-r--r-- 1 storytelling storytellung  567 May  8 17:17 20150508171731_create_friendly_id_slugs.rb
-rw-r--r-- 1 storytelling storytellung 8967 May  8 17:17 20150508171736_setup_schema.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  694 May  8 17:17 20150508171737_add_attributes_to_users.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  401 May  8 17:17 20150508171738_create_themings.pageflow.rb
-rw-r--r-- 1 storytelling storytellung 1205 May  8 17:17 20150508171739_create_themings_for_existing_accounts.pageflow.rb
-rw-r--r-- 1 storytelling storytellung 1837 May  8 17:17 20150508171740_change_theme_references_to_theming_references.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  460 May  8 17:17 20150508171741_remove_attributes_from_themes.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  273 May  8 17:17 20150508171742_create_accounts_themes_join_table.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  904 May  8 17:17 20150508171743_move_cname_from_account_to_theming.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  510 May  8 17:17 20150508171744_drop_themes.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  259 May  8 17:17 20150508171745_add_confirmed_by_to_encoded_files.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  526 May  8 17:17 20150508171746_add_home_url_attributes_to_themings_and_revisions.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  298 May  8 17:17 20150508171747_create_widgets.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  264 May  8 17:17 20150508171748_add_emphasize_chapter_beginning_to_revisions.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  248 May  8 17:17 20150508171749_add_emphasize_new_pages_to_revisions.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  331 May  8 17:17 20150508171750_add_sharing_image_to_revisions.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  177 May  8 17:17 20150508171751_add_locale_to_users.pageflow.rb
-rw-r--r-- 1 storytelling storytellung  194 May  8 17:17 20150508171752_add_locale_to_revisions.pageflow.rb

and here _add_attributes_to_users.pageflow.rb

# This migration comes from pageflow (originally 20140418240000)
class AddAttributesToUsers < ActiveRecord::Migration
  def change
    add_column :users, :failed_attempts, :integer, default: 0
    add_column :users, :locked_at, :datetime

    add_column :users, :first_name, :string
    add_column :users, :last_name, :string
    add_column :users, :suspended_at, :datetime
    add_column :users, :account_id, :integer
    add_column :users, :role, :string, default: "editor", null: false

    add_index :users, [:account_id], name: "index_pageflow_users_on_account_id", using: :btree
    add_index :users, [:email], name: "index_pageflow_users_on_email", unique: true, using: :btree
  end
end
tf commented 9 years ago

The problem is that devise somehow thinks that a user model already exists and therefore creates an add_devise_to_users migration instead of a devise_create_user migration. So then when you migrate, it fails because the migration tries to alter a table that does not exists.

Looking at the source of the devise generator, it looks like this happens, when the file app/models/user.rb exists prior to running the generator. If you start with an empty rails app this cannot be the case. But maybe you already were in an inconsistent state due to a prior error?

amo42 commented 9 years ago

That could be possible. So I will start over again hopefully now it runs without any problem. I'll inform you about the status afterwards. Stay tuned and have a nice weekend so far :)

amo42 commented 9 years ago

So for now a clean installation works much better. Thank you very much.

But still receiving an error while inviting an user.

Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true

Can you tell me where is this parameter set up?

king regards

tf commented 9 years ago

Ah ok. There's a manual configuration step required for Devise (the auth framework used by Pageflow). During the install process, it should also output a hint what needs to be done, but we should probably also add it to the README. At some point, the Devise generator says:

     Ensure you have defined default url options in your environments files. Here 
     is an example of default_url_options appropriate for a development environment 
     in config/environments/development.rb:

       config.action_mailer.default_url_options = { :host => 'localhost:3000' }

     In production, :host should be set to the actual host of your application.

This is required, since Devise needs to know a host to generate "change password"-URLs inside emails. I'll add a note to our README.

amo42 commented 9 years ago

So this works now without any issues. Thanks for your technical support.

just fyi, within the clean installation the file extension .rb was missing again

tf commented 9 years ago

Great! Just FYI I've updated the readme to include the default_url_options step.