I am working on a Rails app with Sqlite and have a users table associated with several other tables. When trying to rename a column in Users, I'm getting the subject error when running rails db:migrate.
I see a lot of posts here with similar issues, but none has worked. Specifically, the common remedy seems to be to use "dependent: :destroy" on all has_many and has_one associations. I am doing this but am still getting the error.
What am I doing wrong?
Below is my code:
class User < ApplicationRecord
  devise :database_authenticatable, :registerable,
  :recoverable, :rememberable, :trackable, :validatable
  has_one :profile, dependent: :destroy
  has_many :bikes, dependent: :destroy
  has_many :bookings, dependent: :destroy
  has_many :rented_bikes, through: :bookings, source: :bike
  has_many :conversations, dependent: :destroy
  has_many :likes, dependent: :destroy
  has_many :liked_bikes, through: :likes, :source => :bike
  has_many :viewed_bikes, through: :views, :source => :bike
  has_many :views, dependent: :destroy
  has_many :reviews, dependent: :destroy
end
class Profile < ApplicationRecord
  belongs_to :user
end
class Bike < ApplicationRecord
  belongs_to :user
  has_many :images, dependent: :destroy
  has_many :bookings, dependent: :destroy
  has_many :booked_users, through: :bookings, source: :user
  has_many :conversations, dependent: :destroy
  has_many :likes, dependent: :destroy
  has_many :liking_users, :through => :likes, :source => :user
  has_one :amenity, dependent: :destroy
  has_many :places, dependent: :destroy
  has_many :views, dependent: :destroy
end
class Booking < ApplicationRecord
  belongs_to :bike
  belongs_to :user
  has_one :review, dependent: :destroy
  validates :date_start, presence: true
  validates :date_end, presence: true
  validates :user_id, presence: true
end
class Conversation < ApplicationRecord
  belongs_to :user
  belongs_to :bike
  has_many :messages, dependent: :destroy
end
class Like < ApplicationRecord
  belongs_to :user
  belongs_to :flat
end
class View < ApplicationRecord
  belongs_to :user
  belongs_to :flat
end
class Review < ApplicationRecord
  belongs_to :user
  belongs_to :booking
end
Migration:
class ChangeCustomerIdToUserId < ActiveRecord::Migration[5.1]
  def change
    rename_column :users, :customer_id, :client_id
  end
end