Skip to content

Commit

Permalink
Merge 8bac9e6 into fae8612
Browse files Browse the repository at this point in the history
  • Loading branch information
prabalsingh24 committed Sep 4, 2020
2 parents fae8612 + 8bac9e6 commit e7af08e
Show file tree
Hide file tree
Showing 58 changed files with 5,603 additions and 252 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ addons:
env:
global:
- CXX=g++-4.8

before_install:
- sudo service postgresql stop
- printf "local all all trust\nhost all all 127.0.0.1 trust" > pg_hba.conf
Expand Down
48 changes: 24 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@
"@fortawesome/free-brands-svg-icons": "^5.14.0",
"@fortawesome/free-solid-svg-icons": "^5.14.0",
"@fortawesome/react-fontawesome": "^0.1.11",
"bluebird": "^3.5.1",
"body-parser": "^1.14.1",
"bookbrainz-data": "^2.6.1",
"chai-arrays": "^2.2.0",
"chai-sorted": "^0.2.0",
"chart.js": "^2.9.3",
"classnames": "^2.2.5",
Expand Down
7 changes: 7 additions & 0 deletions sql/migrations/user-collection/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BEGIN;

DROP TABLE IF EXISTS bookbrainz.user_collection;
DROP TABLE IF EXISTS bookbrainz.user_collection_collaborator;
DROP TABLE IF EXISTS bookbrainz.user_collection_item;

COMMIT;
38 changes: 38 additions & 0 deletions sql/migrations/user-collection/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
BEGIN;

CREATE TABLE IF NOT EXISTS bookbrainz.user_collection (
id UUID PRIMARY KEY DEFAULT public.uuid_generate_v4(),
owner_id INT NOT NULL,
name VARCHAR(80) NOT NULL CHECK (name <> ''),
description TEXT NOT NULL DEFAULT '',
entity_type bookbrainz.entity_type NOT NULL,
public BOOLEAN NOT NULL DEFAULT FALSE,
created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT timezone('UTC'::TEXT, now()),
last_modified TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT timezone('UTC'::TEXT, now())
);
ALTER TABLE bookbrainz.user_collection ADD FOREIGN KEY (owner_id) REFERENCES bookbrainz.editor (id);

CREATE TABLE IF NOT EXISTS bookbrainz.user_collection_item (
collection_id UUID,
bbid UUID,
added_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT timezone('UTC'::TEXT, now()),
PRIMARY KEY (
collection_id,
bbid
)
);
ALTER TABLE bookbrainz.user_collection_item ADD FOREIGN KEY (collection_id) REFERENCES bookbrainz.user_collection (id) ON DELETE CASCADE;
ALTER TABLE bookbrainz.user_collection_item ADD FOREIGN KEY (bbid) REFERENCES bookbrainz.entity (bbid);

CREATE TABLE IF NOT EXISTS bookbrainz.user_collection_collaborator (
collection_id UUID,
collaborator_id INT,
PRIMARY KEY (
collection_id,
collaborator_id
)
);
ALTER TABLE bookbrainz.user_collection_collaborator ADD FOREIGN KEY (collection_id) REFERENCES bookbrainz.user_collection (id) ON DELETE CASCADE;
ALTER TABLE bookbrainz.user_collection_collaborator ADD FOREIGN KEY (collaborator_id) REFERENCES bookbrainz.editor (id);

COMMIT;
35 changes: 35 additions & 0 deletions sql/schemas/bookbrainz.sql
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,41 @@ ALTER TABLE bookbrainz.link_import ADD FOREIGN KEY (entity_id) REFERENCES bookbr
ALTER TABLE bookbrainz.link_import ADD FOREIGN KEY (import_id) REFERENCES bookbrainz.import (id);
ALTER TABLE bookbrainz.link_import ADD FOREIGN KEY (origin_source_id) REFERENCES bookbrainz.origin_source (id);

CREATE TABLE bookbrainz.user_collection (
id UUID PRIMARY KEY DEFAULT public.uuid_generate_v4(),
owner_id INT NOT NULL,
name VARCHAR(80) NOT NULL CHECK (name <> ''),
description TEXT NOT NULL DEFAULT '',
entity_type bookbrainz.entity_type NOT NULL,
public BOOLEAN NOT NULL DEFAULT FALSE,
created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT timezone('UTC'::TEXT, now()),
last_modified TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT timezone('UTC'::TEXT, now())
);
ALTER TABLE bookbrainz.user_collection ADD FOREIGN KEY (owner_id) REFERENCES bookbrainz.editor (id);

CREATE TABLE bookbrainz.user_collection_item (
collection_id UUID,
bbid UUID,
added_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT timezone('UTC'::TEXT, now()),
PRIMARY KEY (
bbid,
collection_id
)
);
ALTER TABLE bookbrainz.user_collection_item ADD FOREIGN KEY (collection_id) REFERENCES bookbrainz.user_collection (id) ON DELETE CASCADE;
ALTER TABLE bookbrainz.user_collection_item ADD FOREIGN KEY (bbid) REFERENCES bookbrainz.entity (bbid);

CREATE TABLE bookbrainz.user_collection_collaborator (
collection_id UUID,
collaborator_id INT,
PRIMARY KEY (
collection_id,
collaborator_id
)
);
ALTER TABLE bookbrainz.user_collection_collaborator ADD FOREIGN KEY (collection_id) REFERENCES bookbrainz.user_collection (id) ON DELETE CASCADE;
ALTER TABLE bookbrainz.user_collection_collaborator ADD FOREIGN KEY (collaborator_id) REFERENCES bookbrainz.editor (id);

-- Views --

CREATE VIEW bookbrainz.author AS
Expand Down

0 comments on commit e7af08e

Please sign in to comment.