如何解决Ruby on Rails迁移的问题

时间:2019-06-17 21:11:10

标签: ruby-on-rails ruby

我正在迁移,但未收到任何错误或成功消息:

up do
  create_table :libro_prestamos do
    column :id,                 Integer, :serial => true
    column :estado,             Integer
    column :fecha_prestamo,     Date
    column :fecha_entrega,      Date
    column :fecha_devolucion_real, Date
    column :observacion,        'text'
    column :usuario_id,         'INT(10) UNSIGNED'
    column :libro_copia_id,     'INT(10) UNSIGNED'
    column :created_at,         DateTime
    column :updated_at,         DateTime
    column :deleted_at,         DateTime
  end

  create_table :libro_editoriales do 
      column :id,                 Integer, :serial => true
      column :nombre,             'VARCHAR(300)'
      column :created_at,         DateTime
      column :updated_at,         DateTime
      column :deleted_at,         DateTime
  end

  modify_table :titulos_libros do
    add_column :isbn,         'VARCHAR(200)'
    add_column :stock_copias, 'INT(10) UNSIGNED'
    add_column :libro_editorial_id, 'INT(10) UNSIGNED'
  end
end

down do
  drop_table :libro_prestamos
  drop_table :libro_editoriales
  modify_table :titulos_libros do
    drop_column :isbn
    drop_column :stock_copias
    drop_column :libro_editorial_id
  end
end

1 个答案:

答案 0 :(得分:0)

它是self.upself.down,而不仅仅是updown(我想您对change方法感到困惑)