   name text NOT NULL
 ) WITH (OIDS=FALSE);
 
-CREATE TABLE IF NOT EXISTS projects_share (
-  project uuid PRIMARY KEY REFERENCES projects(id),
+CREATE TABLE IF NOT EXISTS project_shares (
+  id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
+  project uuid REFERENCES projects(id),
   created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
   modified_at timestamptz NOT NULL DEFAULT clock_timestamp(),
   token text


CREATE INDEX projects_user_idx
    ON projects("user");

    SELECT encode(digest(gen_random_bytes(128), 'sha256'), 'hex')
      INTO token;

    INSERT INTO project_shares (project, token)
    VALUES (NEW.id, token);

    RETURN NEW;
