Skip to content

Commit

Permalink
Migrations for sharing permissions data models (#461)
Browse files Browse the repository at this point in the history
* Migrations for sharing permissions data models

* Add missing commas to migrations
  • Loading branch information
marcua authored Sep 22, 2024
1 parent 20569d6 commit 8e49f3e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions migrations/postgres/2024083101_permission.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE entity_database_permission (
entity_id INT NOT NULL,
database_id INT NOT NULL,
sharing_level SMALLINT NOT NULL,

FOREIGN KEY(entity_id) REFERENCES entity(id),
FOREIGN KEY(database_id) REFERENCES database(id),
UNIQUE(entity_id, database_id)
);

ALTER TABLE database ADD public_sharing_level SMALLINT NOT NULL DEFAULT 0; -- defaults to no public access
11 changes: 11 additions & 0 deletions migrations/sqlite/2024083101_permission.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE entity_database_permission (
entity_id INT NOT NULL,
database_id INT NOT NULL,
sharing_level SMALLINT NOT NULL,

FOREIGN KEY(entity_id) REFERENCES entity(id),
FOREIGN KEY(database_id) REFERENCES database(id),
UNIQUE(entity_id, database_id)
);

ALTER TABLE database ADD public_sharing_level SMALLINT NOT NULL DEFAULT 0; -- defaults to no public access

0 comments on commit 8e49f3e

Please sign in to comment.