a thoughtful web.
Good ideas and conversation. No ads, no tracking.   Login or Take a Tour!
comment
paxprose  ·  3419 days ago  ·  link  ·    ·  parent  ·  post: Internal API on Github, New Tag: #devski

It might not be a terrible idea to auto increment a primary key on those reference tables for whenever they get big. You'd just put a FK constraint on those one-to-many relationships in the other tables.

create table if not exists "publication_shared_by" (

  id integer identity(1,1), --primary key will help when this table becomes large
  publication_id       integer, -- fk into publication, NOT a pk, one to many
  username text --create a non-clustered index to the 'username' table or something
);

I'm not sure if the identity(1,1) syntax is correct (I work primarily with a T-SQL system).