After running:
rails g model category
and updating my migration to show:
class CreateCategories < ActiveRecord::Migration
def change create_table :categories do |t|
t.string :name t.text :description
t.timestamps null: false
end
end
end
Then running:
rails g model albumcategories
and updating my migration to show:
class CreateAlbumCategories < ActiveRecord::Migration
def change
create_table :album_categories do |t|
t.references :album, index: true, foreign_key: true
t.references :category, index: true, foreign_key: true
t.timestamps null: false
end
end
end
I ran rake db:migrate
I got the following output:
20160627163454 CreateCategories: migrating =================================
-- create_table(:categories)
-> 0.0768s
== 20160627163454 CreateCategories: migrated (0.0769s) ========================
== 20160627163757 CreateAlbumCategories: migrating ============================
-- create_table(:album_categories)
-> 0.1252s
== 20160627163757 CreateAlbumCategories: migrated (0.1253s) ===================
But neither of these new tables show up in my Schema.
I have tested them both in the console and I am able to connect to them. i.e. @album.categories.count
gives me an output of "0
"
Does anyone know what is going on here? It seems odd that my schema wouldn't update, but the tables would still be available in the console. Databases have been troubling to me in the past, so I don't want to move too far forward just to find out I need to redo a lot of work. Any insight would be appreciated.