diff --git a/core/database/src/commonMain/sqldelight/com/google/samples/apps/nowinandroid/core/database/NewsResourceTopicCrossRef.sq b/core/database/src/commonMain/sqldelight/com/google/samples/apps/nowinandroid/core/database/NewsResourceTopicCrossRef.sq new file mode 100644 index 000000000..c76510666 --- /dev/null +++ b/core/database/src/commonMain/sqldelight/com/google/samples/apps/nowinandroid/core/database/NewsResourceTopicCrossRef.sq @@ -0,0 +1,10 @@ +CREATE TABLE 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 TopicEntity(id) ON DELETE CASCADE +); + +CREATE INDEX idx_news_resource_id ON news_resources_topics(news_resource_id); +CREATE INDEX idx_topic_id ON news_resources_topics(topic_id);