diff --git a/config/database.rb b/config/database.rb
index <HASH>..<HASH> 100644
--- a/config/database.rb
+++ b/config/database.rb
@@ -19,8 +19,8 @@ CREATE TABLE IF NOT EXISTS favorites_tags(
   id INTEGER PRIMARY KEY AUTOINCREMENT,
   tag_id INTEGER,
   favorite_id INTEGER,
-  FOREIGN KEY(tag_id) REFERENCES tags(id),
-  FOREIGN KEY(favorite_id) REFERENCES favorites(id),
+  FOREIGN KEY(tag_id) REFERENCES tags(id) ON DELETE CASCADE,
+  FOREIGN KEY(favorite_id) REFERENCES favorites(id) ON DELETE CASCADE,
   UNIQUE(tag_id, favorite_id) ON CONFLICT REPLACE
 );
 SQL
diff --git a/test/ruby_pocket/favorite_test.rb b/test/ruby_pocket/favorite_test.rb
index <HASH>..<HASH> 100644
--- a/test/ruby_pocket/favorite_test.rb
+++ b/test/ruby_pocket/favorite_test.rb
@@ -63,6 +63,13 @@ module RubyPocket
       assert_equal ruby_flow.tags, ruby_tapas.tags
     end
 
+    def test_favorites_with_tags_are_deleted_without_errors
+      values = build_values(tag_names: %w(one two))
+      favorite = Favorite.create values
+
+      assert favorite.destroy
+    end
+
     private
 
     def build_values(values = {})
Delete favorites with tags without FK errors