forked from openfga/openfga
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab0d835
commit d74c600
Showing
25 changed files
with
1,498 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
-- +goose Up | ||
CREATE TABLE tuple ( | ||
store NVARCHAR(26) NOT NULL, | ||
object_type NVARCHAR(128) NOT NULL, | ||
object_id NVARCHAR(128) NOT NULL, | ||
relation NVARCHAR(50) NOT NULL, | ||
_user NVARCHAR(256) NOT NULL, | ||
user_type NVARCHAR(7) NOT NULL, | ||
ulid NVARCHAR(26) NOT NULL, | ||
inserted_at DATETIME2 NOT NULL, | ||
PRIMARY KEY NONCLUSTERED (store, object_type, object_id, relation, _user) | ||
); | ||
|
||
CREATE UNIQUE INDEX idx_tuple_ulid ON tuple (ulid); | ||
|
||
CREATE TABLE authorization_model ( | ||
store NVARCHAR(26) NOT NULL, | ||
authorization_model_id NVARCHAR(26) NOT NULL, | ||
type NVARCHAR(256) NOT NULL, | ||
type_definition VARBINARY(MAX), | ||
PRIMARY KEY (store, authorization_model_id, type) | ||
); | ||
|
||
CREATE TABLE store ( | ||
id NVARCHAR(26) PRIMARY KEY, | ||
name NVARCHAR(64) NOT NULL, | ||
created_at DATETIME2 NOT NULL, | ||
updated_at DATETIME2, | ||
deleted_at DATETIME2 | ||
); | ||
|
||
CREATE TABLE assertion ( | ||
store NVARCHAR(26) NOT NULL, | ||
authorization_model_id NVARCHAR(26) NOT NULL, | ||
assertions VARBINARY(MAX), | ||
PRIMARY KEY (store, authorization_model_id) | ||
); | ||
|
||
CREATE TABLE changelog ( | ||
store NVARCHAR(26) NOT NULL, | ||
object_type NVARCHAR(256) NOT NULL, | ||
object_id NVARCHAR(256) NOT NULL, | ||
relation NVARCHAR(50) NOT NULL, | ||
_user NVARCHAR(512) NOT NULL, | ||
operation BIGINT NOT NULL, | ||
ulid NVARCHAR(26) NOT NULL, | ||
inserted_at DATETIME2 NOT NULL, | ||
PRIMARY KEY (store, ulid, object_type) | ||
); | ||
|
||
-- +goose Down | ||
DROP TABLE tuple; | ||
DROP TABLE authorization_model; | ||
DROP TABLE store; | ||
DROP TABLE assertion; | ||
DROP TABLE changelog; |
6 changes: 6 additions & 0 deletions
6
assets/migrations/mssql/002_add_authorization_model_version.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- +goose Up | ||
ALTER TABLE authorization_model ADD schema_version NVARCHAR(5) CONSTRAINT DF_schema_version DEFAULT '1.0' NOT NULL; | ||
|
||
-- +goose Down | ||
ALTER TABLE authorization_model DROP CONSTRAINT DF_schema_version; | ||
ALTER TABLE authorization_model DROP COLUMN schema_version; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- +goose Up | ||
CREATE INDEX idx_reverse_lookup_user on tuple (store, object_type, relation, _user); | ||
|
||
-- +goose Down | ||
DROP INDEX idx_reverse_lookup_user on tuple; |
5 changes: 5 additions & 0 deletions
5
assets/migrations/mssql/004_add_authorization_model_serialized_protobuf.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- +goose Up | ||
ALTER TABLE authorization_model ADD serialized_protobuf VARBINARY(MAX); | ||
|
||
-- +goose Down | ||
ALTER TABLE authorization_model DROP COLUMN serialized_protobuf; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- +goose Up | ||
ALTER TABLE tuple ADD condition_name NVARCHAR(256); | ||
ALTER TABLE tuple ADD condition_context VARBINARY(MAX); | ||
ALTER TABLE changelog ADD condition_name NVARCHAR(256); | ||
ALTER TABLE changelog ADD condition_context VARBINARY(MAX); | ||
|
||
-- +goose Down | ||
ALTER TABLE tuple DROP COLUMN condition_name; | ||
ALTER TABLE tuple DROP COLUMN condition_context; | ||
ALTER TABLE changelog DROP COLUMN condition_name; | ||
ALTER TABLE changelog DROP COLUMN condition_context; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.