Add reference in my migration error
i create rails new demo_project using using mysql database my credentials was ok i create table my using rake db:create
Created database 'demo_project_development'
Created database 'demo_project_test'
then i generate a table
rails g model Product name:string description:text inventory:integer 'price:decimal{7,2}' restocked_at:datetime
and it was success
class CreateProducts < ActiveRecord::Migration[5.0]
def change
create_table :products do |t|
t.string :name
t.text :description
t.integer :inventory
t.decimal :price, precision: 7, scale: 2
t.datetime :restocked_at
t.timestamps
end
end
end
after that i generate a migration
rails g migration AddQtySoldToProducts qty_solid:integer
and create this
class AddQtySoldToProducts < ActiveRecord::Migration[5.0]
def change
add_column :products, :qty_solid, :integer
end
end
and after that i create another migration
rails g migration AddRefNumToProducts ref_num:string:index
and create this
class AddRefNumToProducts < ActiveRecord::Migration[5.0]
def change
add_column :products, :ref_num, :string
add_index :products, :ref_num
end
end
and the last migration
rails g migration AddStyleToProducts style:references
and create this
class AddStyleToProducts < ActiveRecord::Migration[5.0]
def change
add_reference :products, :style, foreign_key: true
end
end
when i run rake db:migrate
i got an error
== 20170213061527 CreateProducts: migrating
-- create_table(:products) -> 0.1451s == 20170213061527 CreateProducts: migrated (0.1453s) ==========================
== 20170213061805 AddQtySoldToProducts: migrating ============================= -- add_column(:products, :qty_solid, :integer) -> 0.3441s == 20170213061805 AddQtySoldToProducts: migrated (0.3443s) ====================
== 20170213061950 AddRefNumToProducts: migrating ============================== -- add_column(:products, :ref_num, :string) -> 0.0964s -- add_index(:products, :ref_num) -> 0.4156s == 20170213061950 AddRefNumToProducts: migrated (0.5121s) =====================
== 20170213062130 AddStyleToProducts: migrating =============================== -- add_reference(:products, :style, {:foreign_key=>true}) rake aborted! StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: Cannot add foreign key constraint: ALTER TABLE products
ADD CONSTRAINT fk_rails_326a064677
FOREIGN KEY ( style_id
) REFERENCES styles
( id
) /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/mysql2-0.4.5/lib/mysql2/client.rb:120:in _query' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/mysql2-0.4.5/lib/mysql2/client.rb:120:in
block in query' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/mysql2-0.4.5/lib/mysql2/client.rb:119:in handle_interrupt' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/mysql2-0.4.5/lib/mysql2/client.rb:119:in
query' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:218:in block in execute' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:589:in
block in log' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activesupport-5.0.1/lib/active_support/notifications/instrumenter.rb:21:in instrument' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:583:in
instrument' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:583:in
log' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:218:in execute' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/mysql/database_statements.rb:31:in
execute' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:916:in add_foreign_key' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:623:in
foreign_key' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:100:in add_to' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:826:in
add_reference' /U sers/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:846:in block in method_missing' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:815:in
block in say_with_time' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:815:in say_with_time' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:835:in
method_missing' /Users/cdasia-tsd/Desktop/demo_project/db/migrate/20170213062130_add_style_to_products.rb:3:in change' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:789:in
exec_migration' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:773:in block (2 levels) in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:772:in
block in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activ erecord-5.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in with_connection' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:771:in
migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:951:in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1212:in
block in execute_migration_in_transaction' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1282:in ddl_transaction' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1211:in
execute_migration_in_transaction' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1184:in block in migrate_without_lock' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1183:in
each' /Users/cdasia-tsd/.rvm/gems/ruby-2. 3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1183:in migrate_without_lock' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1132:in
block in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1299:in with_advisory_lock' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1132:in
migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1006:in up' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:984:in
migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/tasks/database_tasks.rb:161:in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/railties/databases.rake:58:in
block (2 levels) in ' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/rake-12.0.0/exe/rake:27:in <top (required)>' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in
<top (required)>' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in
eval' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in <main>' ActiveRecord::StatementInvalid: Mysql2::Error: Cannot add foreign key constraint: ALTER TABLE
products ADD CONSTRAINT
fk_rails_326a064677 FOREIGN KEY (
style_id ) REFERENCES
styles (
id ) /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/mysql2-0.4.5/lib/mysql2/client.rb:120:in
_query' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/mysql2-0.4.5/lib/mysql2/client.rb:120:in block in query' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/mysql2-0.4.5/lib/mysql2/client.rb:119:in
handle_interrupt' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/mysql2-0.4.5/lib/mysql2/client.rb:119:in query' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:218:in
block in execute' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract_adap ter.rb:589:in block in log' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activesupport-5.0.1/lib/active_support/notifications/instrumenter.rb:21:in
instrument' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:583:in log' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:218:in
execute' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/mysql/database_statements.rb:31:in execute' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:916:in
add_foreign_key' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:623:in foreign_key' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:100:in
foreign_key' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:100:in
add_to' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:826:in add_reference' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:846:in
block in method_missing' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:815:in block in say_with_time' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:815:in
say_with_time' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:835:in method_missing' /Users/cdasia-tsd/Desktop/demo_project/db/migrate/20170213062130_add_style_to_products.rb:3:in
change' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:789:in exec_migration' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:773:in
block (2 levels) in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:772:in block in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in
with_connection' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:771:in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:951:in
migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1212:in block in execute_migration_in_transaction' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1282:in
ddl_transaction' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1211:in execute_migration_in_transaction' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1184:in
execute_migration_in_transaction' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1184:in
block in migrate_without_lock' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1183:in each' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1183:in
migrate_without_lock' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1132:in block in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1299:in
with_advisory_lock' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1132:in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1006:in
up' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:984:in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/tasks/database_tasks.rb:161:in
migrate' /Users/cdasia-tsd/.rvm/gems/ruby -2.3.3/gems/activerecord-5.0.1/lib/active_record/railties/databases.rake:58:in block (2 levels) in <top (required)>' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/rake-12.0.0/exe/rake:27:in
' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in eval' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in
' Mysql2::Error: Cannot add foreign key constraint /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/mysql2-0.4.5/lib/mysql2/client.rb:120:in _query' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/mysql2-0.4.5/lib/mysql2/client.rb:120:in
block in query' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/mysql2-0.4.5/lib/mysql2/client.rb:119:in handle_interrupt' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/mysql2-0.4.5/lib/mysql2/client.rb:119:in
query' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:218:in block in execute' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:589:in
block in execute' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:589:in
block in log' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activesupport-5.0.1/lib/active_support/notifications/instrumenter.rb:21:in instrument' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:583:in
log' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:218:in execute' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/mysql/database_statements.rb:31:in
execute' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:916:in add_foreign_key' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:623:in
foreign_key' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/ac tive_record/connection_adapters/abstract/schema_definitions.rb:100:in add_to' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:826:in
add_reference' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:846:in block in method_missing' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:815:in
block in say_with_time' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:815:in say_with_time' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:835:in
method_missing' /Users/cdasia-tsd/Desktop/demo_project/db/migrate/20170213062130_add_style_to_products.rb:3:in change' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:789:in
exec_migration' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/li b/active_record/migration.rb:773:in block (2 levels) in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:772:in
block in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in with_connection' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:771:in
migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:951:in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1212:in
block in execute_migration_in_transaction' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1282:in ddl_transaction' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1211:in
execute_migration_in_transaction' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems /activerecord-5.0.1/lib/active_record/migration.rb:1184:in block in migrate_without_lock' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1183:in
each' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1183:in migrate_without_lock' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1132:in
block in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1299:in with_advisory_lock' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1132:in
migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:1006:in up' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/migration.rb:984:in
migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/tasks/database_tasks.rb:161: in migrate' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/activerecord-5.0.1/lib/active_record/railties/databases.rake:58:in
block (2 levels) in ' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/gems/rake-12.0.0/exe/rake:27:in <top (required)>' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in
eval' /Users/cdasia-tsd/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in `' Tasks: TOP => db:migrate (See full trace by running task with --trace) TSD-Interns-MacBook-Pro:demo_project cdasia-tsd$
你没有styles
表。
Yes, before running this migration you should create style table other wise you got same issue.
Please have a look below link might be it would help you -
add_reference link1
add_reference link2
Note: if you are writing anywhere add_reference then please make sure first this table should be present or if you want to create together all migration then order of migration should be first migration of reference table creation after that run migration which have add_reference.
链接地址: http://www.djcxy.com/p/49948.html上一篇: 灵活的网页开发与轨道4
下一篇: 在我的迁移错误中添加参考