Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data subject within non-data subject table (sample application: Mouthful) #171

Open
benkilimnik opened this issue May 9, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@benkilimnik
Copy link
Member

Encountered in the sample application schema for Mouthful located in experiments/schema-annot/annotated/mouthful-annotated.sql

K9db cannot accurately capture the Author column in the Comment table which refers to a data subject that owns all data. (The entire application contains just two tables: Comment and Thread).

CREATE TABLE Thread(
    Id int PRIMARY KEY,
    CreatedAt datetime not null,
    Path text not null
);

CREATE TABLE Comment(
    Id int PRIMARY KEY,
    ThreadId int not null,
    Body text not null,
    Author text not null,
    Confirmed int not null,
    CreatedAt datetime not null,
    ReplyTo int not null,
    DeletedAt datetime not null,
    FOREIGN KEY(ThreadId) references Thread(Id),
);

Work around: modify schema by adding a separate user table

CREATE DATA_SUBJECT TABLE user (
    id text PRIMARY KEY
);

and then adding a foreign key to user(id) in Comment

FOREIGN KEY(Author) OWNED_BY user(id)
@benkilimnik benkilimnik added the bug Something isn't working label May 10, 2023
@KinanBab KinanBab added enhancement New feature or request and removed bug Something isn't working labels May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants