{"height":"190","url":"https://nainaistar.hatenablog.com/entry/delete-parent-with-child-in-sqlmodel","provider_name":"Hatena Blog","image_url":"https://cdn-ak.f.st-hatena.com/images/fotolife/n/nainaistar/20240825/20240825234449.png","version":"1.0","author_name":"nainaistar","author_url":"https://blog.hatena.ne.jp/nainaistar/","provider_url":"https://hatena.blog","blog_url":"https://nainaistar.hatenablog.com/","title":"SQLModel\u3067\u89aa\u3068\u4e00\u7dd2\u306b\u5b50\u30c6\u30fc\u30d6\u30eb\u3092\u524a\u9664\u3059\u308b(cascade_delete, ondelete)","width":"100%","description":"\u59cb\u3081\u306b \u5916\u90e8\u30ad\u30fc\u5236\u7d04\u304c\u3042\u308b\u30ec\u30b3\u30fc\u30c9\u3092\u524a\u9664\u3059\u308b\u3068\u304d\u3001\u53c2\u7167\u5143\u30c6\u30fc\u30d6\u30eb\u3088\u308a\u3082\u53c2\u7167\u5148\u30c6\u30fc\u30d6\u30eb\u3092\u5148\u306b\u524a\u9664\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 Rails\u306e\u5834\u5408\u3001\u6b21\u306e\u3088\u3046\u306bdependent\u306b\u5b9a\u7fa9\u3057\u3066\u304a\u304f\u3068\u3001Parent\u30c6\u30fc\u30d6\u30eb\u3092\u524a\u9664\u3057\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067Child\u30c6\u30fc\u30d6\u30eb\u3082\u524a\u9664\u3055\u308c\u307e\u3059\u3002 class Parent < ApplicationRecord has_one :child, dependent: :destroy end class Child < ApplicationRecord belongs_to :parent end \u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001Python\u306eSQLModel\u3092\u4f7f\u7528\u3057\u305f\u3068\u304d\u306b\u3001Parent\u30c6\u30fc\u30d6\u30eb\u3092\u2026","categories":["Python","\u6280\u8853"],"type":"rich","published":"2024-09-09 12:00:00","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fnainaistar.hatenablog.com%2Fentry%2Fdelete-parent-with-child-in-sqlmodel\" title=\"SQLModel\u3067\u89aa\u3068\u4e00\u7dd2\u306b\u5b50\u30c6\u30fc\u30d6\u30eb\u3092\u524a\u9664\u3059\u308b(cascade_delete, ondelete) - \u304d\u308a\u4e38\u306e\u6280\u8853\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","blog_title":"\u304d\u308a\u4e38\u306e\u6280\u8853\u65e5\u8a18"}