dimanche 13 décembre 2015

Running db:migrate in RubyMine for 2 new models, 1 was created and 1 was not?

so I just tried to add 2 new tables into my schema, events and calendars. When running the db:migrate, it ran without errors, but only the 'events' table has been picked up and put into the visual database. Why is this happening? Is it something to do with the has_many / belongs_to association? Very frustrating!

I have just run the db:migrate:status and it has shown:

Status Migration ID Migration Name

up 20151002160900 Create messages

up 20151123214812 Create calendars

up 20151123220903 Create customers

up 20151123221638 Create businesses

up 20151213150347 Create events

So it is creating calendars allegedly, but it's not appearing in my database to the side.1 . Does anyone know how to fix this? Thanks

EDIT: this is my db.schema

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

create_table "businesses", force: true do |t| t.string "name" t.string "email" t.string "normal_password_digest" t.string "manager_password_digest" t.datetime "created_at" t.datetime "updated_at" end

create_table "customers", force: true do |t| t.datetime "created_at" t.datetime "updated_at" t.integer "business_id" t.string "first_name" t.string "last_name" t.string "email" t.string "password_digest" t.string "remember_digest" t.string "role" end

create_table "events", force: true do |t| t.datetime "created_at" t.datetime "updated_at" t.integer "calendar_id" t.text "name" t.datetime "start" t.datetime "end" t.string "location" end

create_table "messages", force: true do |t| t.text "content" t.datetime "created_at" t.datetime "updated_at" end

end

these are my 2 migration files:

class CreateCalendars < ActiveRecord::Migration def change create_table :calendars do |t|

  t.timestamps
  t.references :customer, foreign_key: true



  t.string :name
  t.string :googlePass
  t.string :googleID




end

end end

class CreateEvents < ActiveRecord::Migration def change create_table :events do |t|

  t.timestamps
  t.references :calendar, foreign_key: true

  t.text :name
  t.datetime :start
  t.datetime :end
  t.string :location




end

end end

Aucun commentaire:

Enregistrer un commentaire