bonjour
j'ai un scheme classque commande/article
j'ai bien tout defini dans mon app ROR mais quand je regarde la vue relationnelle de ma table article, la foreign_key fk_articles_commandes sur ON_DELETE est initialisée à RESTRICT au lieu de CASCADE
je vous transmet ma config ci-dessous
peut-être ai-je oublié qq chose !
app/model/commande.rb
class Commande < ActiveRecord::Base
has_many :articles, dependent: :destroy
end
app/model/articles.rb
class Article < ActiveRecord::Base
belongs_to :commande
end
db/migrate/20160126131034_create_articles.rb
class CreateArticles < ActiveRecord::Migration
def change
create_table :articles do |t|
t.string :ref
t.belongs_to :commande
t.timestamps
end
add_foreign_key :articles, :commandes, name: :fk_articles_commandes, on_delete: :cascade, on_update: :nullify
end
end
db/migrate/20160126131258_create_commandes.rb
class CreateCommandes < ActiveRecord::Migration
def change
create_table :commandes do |t|
t.string :ref
t.string :name
t.timestamps
end
end
end
si vous avez une idée
merci
Ma Config :
ruby 2.2.4 p230
rails 4.1.7
mysql 5.7.14