I have these three columns in my Blog
table that do not have data types, e.g: Blog(id: integer, url: text, created_at: datetime, updated_at: datetime, webname: , name: text, homeurl: , blogname: , home_url: text, blog_name: string)
Where homeurl:
, blogname:
, and webname:
do not have any datatypes for some reason. Not sure how they were added to the database, but I want to remove them, since my Blogs
table won't display in the schema.rb
section of my rails app.
Problem is, all methods I have tried do not work. I have tried to rake db:migration RemoveColumn
with this as my migration file:
class RemoveColumn < ActiveRecord::Migration
def up
remove_column :blogs, :homeurl
end
end
This returns the following error: undefined method "to_sym" for nil:NilClass/db/migrate/20150727201931_remove_columns.rb:3:in "up" NoMethodError: undefined method "to_sym" for nil:NilClass
I try to add a datatype to the column, I get the same "to_sym" error. I have also tried to delete the column in the console, same error.
Is there a way to delete a column that doesn't have a datatype? Or is there a way to add a datatype to a column where one doesn't exist?
Aucun commentaire:
Enregistrer un commentaire