-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ODS-6602] Database changes - API only allows tenant1's profiles when…
… different profiles are set up for different tenants (#1212)
- Loading branch information
1 parent
4d242b0
commit eaa6813
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
Artifacts/MsSql/Structure/Admin/0177-Add-Unique-Constraint-Profiles.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,12 @@ | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
-- Licensed to the Ed-Fi Alliance under one or more agreements. | ||
-- The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. | ||
-- See the LICENSE and NOTICES files in the project root for more information. | ||
|
||
ALTER TABLE dbo.Profiles | ||
ALTER COLUMN ProfileName NVARCHAR(500) NOT NULL | ||
GO | ||
|
||
ALTER TABLE dbo.Profiles DROP CONSTRAINT IF EXISTS UQ_Profiles_ProfileName; | ||
ALTER TABLE dbo.Profiles ADD CONSTRAINT UQ_Profiles_ProfileName UNIQUE (ProfileName); | ||
GO |
43 changes: 43 additions & 0 deletions
43
Artifacts/PgSql/Structure/Admin/0177-Add-Unique-Constraint-Profiles.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,43 @@ | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
-- Licensed to the Ed-Fi Alliance under one or more agreements. | ||
-- The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. | ||
-- See the LICENSE and NOTICES files in the project root for more information. | ||
DO $$ | ||
BEGIN | ||
|
||
DROP VIEW IF EXISTS dbo.apiclientidentityrawdetails; | ||
|
||
ALTER TABLE IF EXISTS dbo.profiles | ||
ALTER COLUMN profilename TYPE character varying(500) COLLATE pg_catalog."default"; | ||
|
||
ALTER TABLE dbo.profiles DROP CONSTRAINT IF EXISTS profiles_profilename_key; | ||
ALTER TABLE dbo.profiles ADD CONSTRAINT profiles_profilename_key UNIQUE (profilename); | ||
|
||
CREATE OR REPLACE VIEW dbo.apiclientidentityrawdetails | ||
AS | ||
SELECT ac.key, | ||
ac.usesandbox, | ||
ac.studentidentificationsystemdescriptor, | ||
aeo.educationorganizationid, | ||
app.claimsetname, | ||
vnp.namespaceprefix, | ||
p.profilename, | ||
ac.creatorownershiptokenid_ownershiptokenid AS creatorownershiptokenid, | ||
acot.ownershiptoken_ownershiptokenid AS ownershiptokenid, | ||
ac.apiclientid, | ||
ac.secret, | ||
ac.secretishashed | ||
FROM dbo.apiclients ac | ||
JOIN dbo.applications app ON app.applicationid = ac.application_applicationid | ||
LEFT JOIN dbo.vendors v ON v.vendorid = app.vendor_vendorid | ||
LEFT JOIN dbo.vendornamespaceprefixes vnp ON v.vendorid = vnp.vendor_vendorid | ||
LEFT JOIN dbo.apiclientapplicationeducationorganizations acaeo ON acaeo.apiclient_apiclientid = ac.apiclientid | ||
LEFT JOIN dbo.applicationeducationorganizations aeo ON aeo.applicationeducationorganizationid = acaeo.applicationedorg_applicationedorgid | ||
LEFT JOIN dbo.profileapplications ap ON ap.application_applicationid = app.applicationid | ||
LEFT JOIN dbo.profiles p ON p.profileid = ap.profile_profileid | ||
LEFT JOIN dbo.apiclientownershiptokens acot ON ac.apiclientid = acot.apiclient_apiclientid; | ||
|
||
ALTER TABLE dbo.apiclientidentityrawdetails | ||
OWNER TO postgres; | ||
|
||
END $$; |