Skip to Content
Hands-On Software Engineering with Golang
book

Hands-On Software Engineering with Golang

by Achilleas Anagnostopoulos
January 2020
Intermediate to advanced
640 pages
16h 56m
English
Packt Publishing
Content preview from Hands-On Software Engineering with Golang

An overview of the DB schema for the CockroachDB implementation

Setting up the tables we need for the CockroachDB graph implementation is a fairly straightforward process. The following is a combined list of the SQL statements that will be applied when we run the included DB migrations:

CREATE TABLE IF NOT EXISTS links (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    url STRING UNIQUE,
    retrieved_at TIMESTAMP
);

CREATE TABLE IF NOT EXISTS edges (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    src UUID NOT NULL REFERENCES links(id) ON DELETE CASCADE,
    dst UUID NOT NULL REFERENCES links(id) ON DELETE CASCADE,
    updated_at TIMESTAMP,
    CONSTRAINT edge_links UNIQUE(src,dst)
);

You probably noticed that, while building the in-memory graph implementation, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Software Architecture with Golang

Hands-On Software Architecture with Golang

Jyotiswarup Raiturkar

Publisher Resources

ISBN: 9781838554491Supplemental Content