aboutsummaryrefslogtreecommitdiffstats
path: root/golang/sql
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-26 16:42:17 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-26 16:42:19 -0700
commit82f8b4d838de3fb8eda5db9b23c5bc48ab281f9e (patch)
tree2b684049829c72fbdd4289535b18a19b884f377b /golang/sql
parent9b3e52e813bbd9dc9b1771ca2c63e33d93048e97 (diff)
downloadfatcat-82f8b4d838de3fb8eda5db9b23c5bc48ab281f9e.tar.gz
fatcat-82f8b4d838de3fb8eda5db9b23c5bc48ab281f9e.zip
remove golang API server
Not following that path; this is to prevent future confusion. All code is still in version control.
Diffstat (limited to 'golang/sql')
-rw-r--r--golang/sql/dummy-data.sql42
-rw-r--r--golang/sql/fatcat-schema.sql68
2 files changed, 0 insertions, 110 deletions
diff --git a/golang/sql/dummy-data.sql b/golang/sql/dummy-data.sql
deleted file mode 100644
index d553b9f1..00000000
--- a/golang/sql/dummy-data.sql
+++ /dev/null
@@ -1,42 +0,0 @@
-
--- Fake data at the raw SQL level, for early development and testing
-
-BEGIN;
-
-INSERT INTO editor (username, is_admin) VALUES
- ('admin', true),
- ('claire', true),
- ('doug', false);
-
-INSERT INTO editgroup (editor_id, description) VALUES
- (1, 'first edit ever!'),
- (1, 'another one!'),
- (3, 'user edit'),
- (2, 'uncommited edit');
-
-INSERT INTO editor (username, is_admin, active_editgroup_id) VALUES
- ('bnewbold', true, 4);
-
-INSERT INTO changelog (editgroup_id) VALUES
- (1),
- (2),
- (3);
-
-INSERT INTO creator_rev (name, orcid) VALUES
- ('Grace Hopper', null),
- ('Emily Noethe', null),
- ('Christine Moran', '0000-0003-2088-7465');
-
-INSERT INTO creator_ident (id, is_live, rev_id, redirect_id) VALUES
- ('f1f046a3-45c9-4b99-adce-000000000001', true, 1, null),
- ('f1f046a3-45c9-4b99-adce-000000000002', true, 2, null),
- ('f1f046a3-45c9-4b99-adce-000000000003', true, 3, null),
- ('f1f046a3-45c9-4b99-adce-000000000004', false, 2, null);
-
-INSERT INTO creator_edit (ident_id, rev_id, redirect_id, editgroup_id) VALUES
- ('f1f046a3-45c9-4b99-adce-000000000001', 1, null, 1),
- ('f1f046a3-45c9-4b99-adce-000000000002', 2, null, 2),
- ('f1f046a3-45c9-4b99-adce-000000000003', 3, null, 3),
- ('f1f046a3-45c9-4b99-adce-000000000004', 2, null, 4);
-
-COMMIT;
diff --git a/golang/sql/fatcat-schema.sql b/golang/sql/fatcat-schema.sql
deleted file mode 100644
index fe07390f..00000000
--- a/golang/sql/fatcat-schema.sql
+++ /dev/null
@@ -1,68 +0,0 @@
-
--- written for Postgres 9.6 with OSSP extension for UUIDs
-
-CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-
-DROP TABLE IF EXISTS editor CASCADE;
-DROP TABLE IF EXISTS editgroup CASCADE;
-DROP TABLE IF EXISTS changelog CASCADE;
-DROP TABLE IF EXISTS creator_rev CASCADE;
-DROP TABLE IF EXISTS creator_ident CASCADE;
-DROP TABLE IF EXISTS creator_edit CASCADE;
-
--- uuid_generate_v1mc: timestamp ordered, random MAC address
--- uuid_generate_v4: totally random
-
--- NB: could use LIKE clause, or "composite types"
-
-CREATE TABLE editor (
- id BIGSERIAL PRIMARY KEY,
- username TEXT NOT NULL,
- is_admin BOOLEAN NOT NULL DEFAULT false,
- active_editgroup_id BIGINT -- REFERENCES( editgroup(id) via ALTER below
-);
-
-CREATE TABLE editgroup (
- id BIGSERIAL PRIMARY KEY,
- extra_json JSON,
- editor_id BIGSERIAL REFERENCES editor(id) NOT NULL,
- description TEXT
-);
-
-ALTER TABLE editor
- ADD CONSTRAINT editor_editgroupid_fkey FOREIGN KEY (active_editgroup_id)
- REFERENCES editgroup(id);
-
-CREATE TABLE changelog (
- id BIGSERIAL PRIMARY KEY,
- editgroup_id BIGINT REFERENCES editgroup(id) NOT NULL,
- timestamp TIMESTAMP WITHOUT TIME ZONE DEFAULT now()
-);
-
-CREATE TABLE creator_rev (
- id BIGSERIAL PRIMARY KEY,
- extra_json JSON,
-
- name TEXT,
- orcid TEXT
-);
-
--- Could denormalize a "is_live" flag into revision tables, to make indices
--- more efficient
-CREATE INDEX creator_rev_orcid_idx ON creator_rev(orcid) WHERE orcid IS NOT NULL;
-
-CREATE TABLE creator_ident (
- id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
- is_live BOOL NOT NULL DEFAULT false,
- rev_id BIGINT REFERENCES creator_rev(id),
- redirect_id UUID REFERENCES creator_ident(id)
-);
-
-CREATE TABLE creator_edit (
- id BIGSERIAL PRIMARY KEY,
- extra_json JSON,
- ident_id UUID REFERENCES creator_ident(id) NOT NULL,
- rev_id BIGINT REFERENCES creator_rev(id),
- redirect_id UUID REFERENCES creator_ident(id),
- editgroup_id BIGINT REFERENCES editgroup(id) NOT NULL
-);