Ton*_*ony 1 rake ruby-on-rails migrate ruby-on-rails-3
我有一个非常简单的迁移:
class RemoveAuthorIdFromBooks < ActiveRecord::Migration
def change
remove_column :books, :author_id
end
end
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
Mysql2::Error: Error on rename of './mysite_staging/#sql-3b1_3c78' to './mysite_staging/books' (errno: 150): ALTER TABLE `books` DROP `author_id`
Run Code Online (Sandbox Code Playgroud)
这是表的描述:
+------------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------------+---------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| author_id | int(11) | NO | MUL | NULL | |
| title | varchar(255) | NO | | NULL | |
| teaser | varchar(500) | NO | | NULL | |
| description | varchar(2000) | YES | | NULL | |
| cover_image | varchar(255) | NO | | NULL | |
| publication_date | date | NO | | NULL | |
| enabled | tinyint(1) | NO | | 1 | |
| created_at | datetime | NO | | NULL | |
| updated_at | datetime | NO | | NULL | |
| excerpt | text | YES | | NULL | |
| featured | tinyint(1) | YES | | NULL | |
| site_id | int(11) | YES | | NULL | |
+------------------+---------------+------+-----+---------+----------------+
Run Code Online (Sandbox Code Playgroud)
有线索吗?
| 归档时间: |
|
| 查看次数: |
1097 次 |
| 最近记录: |