diff --git a/core/database/src/commonMain/sqldelight/com/google/samples/apps/nowinandroid/core/database/NewsResourceTopics.sq b/core/database/src/commonMain/sqldelight/com/google/samples/apps/nowinandroid/core/database/NewsResourceTopics.sq new file mode 100644 index 000000000..55aaa6b7f --- /dev/null +++ b/core/database/src/commonMain/sqldelight/com/google/samples/apps/nowinandroid/core/database/NewsResourceTopics.sq @@ -0,0 +1,11 @@ +CREATE TABLE IF NOT EXISTS news_resources_topics ( + news_resource_id TEXT NOT NULL, + topic_id TEXT NOT NULL, + PRIMARY KEY(news_resource_id, topic_id), + FOREIGN KEY(news_resource_id) REFERENCES news_resources(id) ON DELETE CASCADE, + FOREIGN KEY(topic_id) REFERENCES topics(id) ON DELETE CASCADE +); + +CREATE INDEX IF NOT EXISTS index_news_resources_topics_news_resource_id ON news_resources_topics(news_resource_id); + +CREATE INDEX IF NOT EXISTS index_news_resources_topics_topic_id ON news_resources_topics(topic_id);