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

Composite primary key #1874

Open
Steven-MKN opened this issue Jan 8, 2025 · 0 comments
Open

Composite primary key #1874

Steven-MKN opened this issue Jan 8, 2025 · 0 comments

Comments

@Steven-MKN
Copy link

Hi,

I'm just trying to figure out how would one create a composite primary key? i.e I have this SQL as an example and I have no idea what the WatermelonDB implementation of this would be

CREATE TABLE voting (
  QuestionID NUMERIC,
  MemberID NUMERIC,
  PRIMARY KEY (QuestionID, MemberID)
);

Also,
how can I have a custom field as a primary key? i.e

CREATE TABLE station (
  StationCode TEXT PRIMARY KEY
);

This would be ideal as the id is not numeric and there isn't any particular sequence, just unique codes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant