diff --git a/seeds/initseed.ts b/seeds/initseed.ts deleted file mode 100644 index b91ed7c..0000000 --- a/seeds/initseed.ts +++ /dev/null @@ -1,20 +0,0 @@ -import Knex from "knex"; - -exports.seed = async function(knex:Knex) { - // Deletes ALL existing entries - await knex('contents').del(); - await knex('contents').insert({ - title:"aaa", - basepath:"testdata", - content_type:"manga", - filename:"test_zip.zip", - additional:JSON.stringify({comment:"comment"}) - }); - await knex('contents').insert({ - title:"aaa", - basepath:"testdata", - content_type:"video", - filename:"video_test.mp4", - additional:JSON.stringify({comment:"test comment"}) - }); -}; diff --git a/src/db/contents.ts b/src/db/contents.ts index 485fd5b..95ae9f4 100644 --- a/src/db/contents.ts +++ b/src/db/contents.ts @@ -34,6 +34,7 @@ class KnexContentsAccessor implements ContentAccessor{ }; async del(id:number) { if (await this.findById(id) !== undefined){ + await this.knex.delete().from("content_tag_relation").where({content_id:id}); await this.knex.delete().from("contents").where({id:id}); return true; }