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

Foreign keys #44

Open
HettieM opened this issue May 29, 2020 · 1 comment
Open

Foreign keys #44

HettieM opened this issue May 29, 2020 · 1 comment
Labels

Comments

@HettieM
Copy link

HettieM commented May 29, 2020

It's a good idea to label fields as foreign keys in your schema - doesn't appear to be entirely necessary, but it's good practice for "referential integrity".
e.g.
CREATE TBALE decks
(
deck_id SERIAL PRIMARY KEY,
owner_id INTEGER,
deck_name VARCHAR(255) NOT NULL,
published BOOLEAN DEFAULT false,
FOREIGN KEY (owner_id) REFERENCES users(user_id)
)

@Roger-Heathcote
Copy link
Contributor

@HettieM Cool, good to know! Thanks.

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

No branches or pull requests

2 participants