seven1m/onebody

Duplicate position column halts rake

itsbm opened this issue · 2 comments

itsbm commented

Hi! I am getting an error after pulling the latest updates from Master and trying to recompile. the position column isn't in the custom fields already, but there is a position column in the people table.

sudo RAILS_ENV=production bundle exec rake db:migrate --trace

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
== 20170819020242 AddPositionToCustomFields: migrating ========================
-- add_column(:custom_fields, :position, :integer)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: Duplicate column name 'position': ALTER TABLE custom_fields ADD position int

---------------apache error.log

App 3836 stderr: Started GET "/people/1244" for xx.xx.xx.xx at 2018-12-04 22:10:49 -0800
App 3836 stderr: Processing by PeopleController#show as HTML
App 3836 stderr: Parameters: {"id"=>"1244"}
App 3836 stderr: Rendering people/show.html.haml within layouts/default
App 3836 stderr: Rendered people/_details.haml (9.2ms)
App 3836 stderr: Rendered people/_friendship.haml (12.9ms)
App 3836 stderr: Rendered people/_contact_controls.haml (16.0ms)
App 3836 stderr: Rendered people/_family_box.haml (8.5ms)
App 3836 stderr: Rendered people/show.html.haml within layouts/default (68.6ms)
App 3836 stderr: Rendered layouts/_favicons.haml (0.3ms)
App 3836 stderr: Rendered layouts/_navbar_right.haml (3.8ms)
App 3836 stderr: Completed 500 Internal Server Error in 165ms (ActiveRecord: 42.2ms)
App 3836 stderr:
App 3836 stderr: ActionView::Template::Error (Mysql2::Error: Table 'onebody.custom_field_tabs' doesn't exist: SHOW FULL FIELDS FROM custom_field_tabs):
App 3836 stderr: 106: = link_to person_relationships_path(@person) do
App 3836 stderr: 107: = icon 'fa fa-link'
App 3836 stderr: 108: = t('nav.profile_sub.relationships')
App 3836 stderr: 109: - CustomFieldTab.all.each do |tab|
App 3836 stderr: 110: %li
App 3836 stderr: 111: = link_to edit_person_path(@person, anchor: "tab-fields-#{tab.id}") do
App 3836 stderr: 112: = icon 'fa fa-bars'
App 3836 stderr:
App 3836 stderr: lib/db_tools.rb:3:in block in scope_by_site_id' App 3836 stderr: app/views/layouts/default.html.haml:109:in _app_views_layouts_default_html_haml__3228331495933064755_87949100'

itsbm commented

I resolved the issue by simply deleting onebody/db/migrate20170819020242_add_position_to_custom_fields.rb

I'm sorry you encountered this error. I cannot think of why this would have happened to you, but your solution is fine! Please let me know if there's anything else I can help with!