Here is my tables :
create table user
(
userId uuid primary key,
name text
)
create table comment_by_post
(
postId uuid,
cmntId timeuuid,
cmntTxt text,
cmntBy uuid,
primary key (postId, cmntId)
)
create table post_likes
(
postId uuid,
userId uuid,
primary key (postId, userId)
)
Here i have few question
How will I know that a user has commented on a post from
comment_by_post
table ?How to do order post comments.
Ordering post likes in
post_likes
tableIf a user is deleted it should remove all entries of given userid from all table.
To run these query what changes I will have to make in schema?
In Cassandra, usually you would need one table per query. So look at your select statement and start creating tables.
This will give you latest 10 comments for that post.
This is not directly possible. To delete from a table you need to know the entire PRIMARY KEY.
One solution is to create another table with userId as PRIMARY KEY and rest of the PRIMARY KEYs of other tables as columns of this table .