Hi, I have designed a Wall Post feature for my fun site. Just want to see if there is other approaches that I should consider.
Right now, I have 3 tables.
- WallPost
- WallPostComment
- WallPostSubscribers
The first two tables are intuitive.
The 3rd one is where I hope to get feedback from.
-- --------------------------------------------------
-- Creating table 'WallPostSubscriber'
-- Friends will have these entries duplated from the original post.
-- --------------------------------------------------
CREATE TABLE [WallPostSubscriber] (
[WallPostId] bigint NOT NULL,
[SubscriberId] int NOT NULL,
PRIMARY KEY ([WallPostId], [SubscriberId]),
CONSTRAINT [FK_WallPost_WallPostSubscriber] FOREIGN KEY ([WallPostId]) REFERENCES [WallPost] ([Id]) ON DELETE CASCADE,
CONSTRAINT [FK_UserProfile_WallPostSubscriber] FOREIGN KEY ([SubscriberId]) REFERENCES [UserProfile] ([UserId])
);
GO
-- I just remmeber this one is covered by PK. CREATE INDEX [IX_WallPostSubscriber_WallPostId] ON [WallPostSubscriber] ([WallPostId] ASC);
GO
CREATE INDEX [IX_WallPostSubscriber_SubscriberId] ON [WallPostSubscriber] ([SubscriberId] ASC);
GO
This is SQLCE, so, I cannot ON DELETE CASCADE for the second FK, just FYI. Basically instead of computing what you should see on your wall, I just duplicate the entries for all the friends upon posting. Also when friendship is created, I will create the entries as well.
Is this any good? It feels so primitive. Is there any clever way than this?
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.