Card |
---|
id | PostgreSQLEnv |
---|
label | PostgreSQL |
---|
| Execute the below script against the Admin App / Admin API database using psql , PgAdmin, or the tool of your choice. Code Block |
---|
language | sql |
---|
title | adminapi-tables-pgsql.sql |
---|
| CREATE SCHEMA IF NOT EXISTS adminapi;
CREATE TABLE adminapi.Applications (
Id INT NOT NULL GENERATED ALWAYS AS IDENTITY,
ConcurrencyToken VARCHAR(128) NULL,
ClientId VARCHAR(256) NULL,
ClientSecret VARCHAR(256) NULL,
Type VARCHAR(256) NULL,
ConsentType VARCHAR(256) NULL,
Permissions VARCHAR NULL,
Properties VARCHAR NULL,
Requirements VARCHAR NULL,
DisplayName VARCHAR(256) NULL,
DisplayNames VARCHAR NULL,
RedirectUris VARCHAR NULL,
PostLogoutRedirectUris VARCHAR NULL,
CONSTRAINT PK_Applications PRIMARY KEY (Id)
);
CREATE TABLE adminapi.Scopes (
Id INT NOT NULL GENERATED ALWAYS AS IDENTITY,
Name VARCHAR(256) NULL,
ConcurrencyToken VARCHAR(128) NULL,
Description VARCHAR NULL,
Descriptions VARCHAR NULL,
DisplayName VARCHAR(256) NULL,
DisplayNames VARCHAR NULL,
Properties VARCHAR NULL,
Resources VARCHAR NULL,
CONSTRAINT PK_Scopes PRIMARY KEY (Id)
);
CREATE TABLE adminapi.Authorizations (
Id INT NOT NULL GENERATED ALWAYS AS IDENTITY,
ConcurrencyToken VARCHAR(128) NULL,
ApplicationId int NOT NULL,
Scopes VARCHAR NULL,
Subject VARCHAR(256) NULL,
Status VARCHAR(256) NULL,
Properties VARCHAR NULL,
CreationDate TIMESTAMP NULL,
CONSTRAINT PK_Authorizations PRIMARY KEY (Id),
CONSTRAINT FK_AuthorizationsId_ApplicationId FOREIGN KEY (ApplicationId) REFERENCES adminapi.Applications (Id) ON DELETE RESTRICT
);
CREATE TABLE adminapi.Tokens (
Id INT NOT NULL GENERATED ALWAYS AS IDENTITY,
ConcurrencyToken VARCHAR(128) NULL,
ApplicationId int NULL,
AuthorizationId int NULL,
Type VARCHAR(256) NULL,
CreationDate TIMESTAMP NULL,
ExpirationDate TIMESTAMP NULL,
RedemptionDate TIMESTAMP NULL,
Payload VARCHAR NULL,
Properties VARCHAR NULL,
Subject VARCHAR(256) NULL,
Status VARCHAR(256) NULL,
ReferenceId VARCHAR(256) NULL,
CONSTRAINT PK_Tokens PRIMARY KEY (Id)
); |
|
Card |
---|
id | SQLServerEnv |
---|
label | SQL Server |
---|
| Execute the below script against the Admin App / Admin API database using SQL Server Management Studio, Azure Data Studio, PowerShell SQL Tools, or the tool of your choice. Code Block |
---|
language | sql |
---|
title | adminapi-tables-mssql.sql |
---|
| IF NOT EXISTS (SELECT 1 FROM sys.schemas WHERE name = 'adminapi')
BEGIN
EXEC( 'CREATE SCHEMA adminapi' );
END
CREATE TABLE adminapi.Applications (
[Id] int identity NOT NULL,
[ConcurrencyToken] NVARCHAR(128) NULL,
[ClientId] NVARCHAR(256) NULL,
[ClientSecret] NVARCHAR(256) NULL,
[Type] NVARCHAR(256) NULL,
[ConsentType] NVARCHAR(256) NULL,
[Permissions] NVARCHAR(MAX) NULL,
[Properties] NVARCHAR(MAX) NULL,
[Requirements] NVARCHAR(MAX) NULL,
[DisplayName] NVARCHAR(256) NULL,
[DisplayNames] NVARCHAR(MAX) NULL,
[RedirectUris] NVARCHAR(MAX) NULL,
[PostLogoutRedirectUris] NVARCHAR(MAX) NULL,
CONSTRAINT PK_Applications PRIMARY KEY (Id)
);
CREATE TABLE adminapi.Scopes (
[Id] int identity NOT NULL,
[Name] NVARCHAR(256) NULL,
[ConcurrencyToken] NVARCHAR(128) NULL,
[Description] NVARCHAR(MAX) NULL,
[Descriptions] NVARCHAR(MAX) NULL,
[DisplayName] NVARCHAR(256) NULL,
[DisplayNames] NVARCHAR(MAX) NULL,
[Properties] NVARCHAR(MAX) NULL,
[Resources] NVARCHAR(MAX) NULL,
CONSTRAINT PK_Scopes PRIMARY KEY (Id)
);
CREATE TABLE adminapi.Authorizations (
[Id] int identity NOT NULL,
[ConcurrencyToken] NVARCHAR(128) NULL,
[ApplicationId] int NOT NULL,
[Scopes] NVARCHAR(MAX) NULL,
[Subject] NVARCHAR(256) NULL,
[Status] NVARCHAR(256) NULL,
[Properties] NVARCHAR(MAX) NULL,
[CreationDate] DATETIME NULL,
CONSTRAINT PK_Authorizations PRIMARY KEY (Id),
CONSTRAINT FK_AuthorizationsId_ApplicationId FOREIGN KEY (ApplicationId) REFERENCES adminapi.Applications (Id) ON DELETE NO ACTION,
);
CREATE TABLE adminapi.Tokens (
[Id] int identity NOT NULL,
[ConcurrencyToken] NVARCHAR(128) NULL,
[ApplicationId] int NULL,
[AuthorizationId] int NULL,
[Type] NVARCHAR(256) NULL,
[CreationDate] DATETIME NULL,
[ExpirationDate] DATETIME NULL,
[RedemptionDate] DATETIME NULL,
[Payload] NVARCHAR(MAX) NULL,
[Properties] NVARCHAR(MAX) NULL,
[Subject] NVARCHAR(256) NULL,
[Status] NVARCHAR(256) NULL,
[ReferenceId] NVARCHAR(256) NULL,
CONSTRAINT PK_Tokens PRIMARY KEY (Id)
); |
|
|