-
Notifications
You must be signed in to change notification settings - Fork 22
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
7594357
commit d0b4f90
Showing
9 changed files
with
296 additions
and
4 deletions.
There are no files selected for viewing
169 changes: 169 additions & 0 deletions
169
...jdbc/src/main/resources/liquibase/changelogs/v4_2_27/4.2.27-change-client-column-size.yml
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,169 @@ | ||
# Change client column from 64 to 255 characters. | ||
databaseChangeLog: | ||
- changeSet: | ||
id: 4.2.27-change-client-column-size-remove-indexes # MSSQL SERVER needs to first remove index before changing type | ||
author: GraviteeSource Team | ||
dbms: mssql | ||
changes: | ||
# device | ||
- dropIndex: | ||
tableName: devices | ||
indexName: idx_devices_domain_client_user | ||
# scope_approvals | ||
- dropIndex: | ||
indexName: idx_scope_approvals_domain_client_user_scope | ||
tableName: scope_approvals | ||
|
||
#access_tokens | ||
- dropIndex: | ||
indexName: idx_access_tokens_client | ||
tableName: access_tokens | ||
- dropIndex: | ||
indexName: idx_access_tokens_domain_client_subject | ||
tableName: access_tokens | ||
|
||
#refresh_tokens | ||
- dropIndex: | ||
indexName: idx_refresh_tokens_client | ||
tableName: refresh_tokens | ||
- dropIndex: | ||
indexName: idx_refresh_tokens_domain_client_subject | ||
tableName: refresh_tokens | ||
|
||
- changeSet: | ||
id: 4.2.27-change-client-column-size | ||
author: GraviteeSource Team | ||
changes: | ||
#devices | ||
- dropIndex: | ||
tableName: devices | ||
indexName: idx_devices_domain_client_user_remember_device_device_id | ||
- modifyDataType: | ||
tableName: devices | ||
columnName: client | ||
newDataType: VARCHAR(255) | ||
- createIndex: # removed index for reference type to be able to change data type of client and not exceed max index length | ||
columns: | ||
- column: | ||
name: reference_id | ||
- column: | ||
name: client | ||
- column: | ||
name: user_id | ||
- column: | ||
name: device_identifier_id | ||
- column: | ||
name: device_id | ||
indexName: idx_devices_domain_client_user_remember_device_device_id | ||
tableName: devices | ||
unique: false | ||
|
||
# scope_approvals | ||
- modifyDataType: | ||
tableName: scope_approvals | ||
columnName: client_id | ||
newDataType: VARCHAR(255) | ||
|
||
#access_tokens | ||
- modifyDataType: | ||
tableName: access_tokens | ||
columnName: client | ||
newDataType: VARCHAR(255) | ||
|
||
#refresh_tokens | ||
- modifyDataType: | ||
tableName: refresh_tokens | ||
columnName: client | ||
newDataType: VARCHAR(255) | ||
|
||
#authorization_codes | ||
- modifyDataType: | ||
tableName: authorization_codes | ||
columnName: client_id | ||
newDataType: VARCHAR(255) | ||
|
||
#pushed_authorization_requests | ||
- modifyDataType: | ||
tableName: pushed_authorization_requests | ||
columnName: client | ||
newDataType: VARCHAR(255) | ||
|
||
#ciba_auth_requests | ||
- modifyDataType: | ||
tableName: ciba_auth_requests | ||
columnName: client | ||
newDataType: VARCHAR(255) | ||
|
||
- changeSet: | ||
id: 4.2.27-change-client-column-size-recreate-indexes # recreating indexes for MS SQL SERVER | ||
author: GraviteeSource Team | ||
dbms: mssql | ||
changes: | ||
# device | ||
- createIndex: | ||
columns: | ||
- column: | ||
name: reference_id | ||
- column: | ||
name: reference_type | ||
- column: | ||
name: client | ||
- column: | ||
name: user_id | ||
indexName: idx_devices_domain_client_user | ||
tableName: devices | ||
unique: false | ||
# scope_approvals | ||
- createIndex: | ||
columns: | ||
- column: | ||
name: domain | ||
- column: | ||
name: client_id | ||
- column: | ||
name: user_id | ||
- column: | ||
name: scope | ||
indexName: idx_scope_approvals_domain_client_user_scope | ||
tableName: scope_approvals | ||
unique: true | ||
|
||
#access_tokens | ||
- createIndex: | ||
columns: | ||
- column: | ||
name: client | ||
indexName: idx_access_tokens_client | ||
tableName: access_tokens | ||
unique: false | ||
- createIndex: | ||
columns: | ||
- column: | ||
name: domain | ||
- column: | ||
name: client | ||
- column: | ||
name: subject | ||
indexName: idx_access_tokens_domain_client_subject | ||
tableName: access_tokens | ||
unique: false | ||
|
||
#refresh_tokens | ||
- createIndex: | ||
columns: | ||
- column: | ||
name: client | ||
indexName: idx_refresh_tokens_client | ||
tableName: refresh_tokens | ||
unique: false | ||
- createIndex: | ||
columns: | ||
- column: | ||
name: domain | ||
- column: | ||
name: client | ||
- column: | ||
name: subject | ||
indexName: idx_refresh_tokens_domain_client_subject | ||
tableName: refresh_tokens | ||
unique: false |
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
40 changes: 40 additions & 0 deletions
40
...tests/src/test/java/io/gravitee/am/repository/oauth2/api/ScopeApprovalRepositoryTest.java
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,40 @@ | ||
/** | ||
* Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.am.repository.oauth2.api; | ||
|
||
import io.gravitee.am.model.oauth2.ScopeApproval; | ||
import io.gravitee.am.repository.oauth2.AbstractOAuthTest; | ||
import io.reactivex.rxjava3.observers.TestObserver; | ||
import org.junit.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
public class ScopeApprovalRepositoryTest extends AbstractOAuthTest { | ||
@Autowired | ||
private ScopeApprovalRepository scopeApprovalRepository; | ||
@Test | ||
public void shouldCreateWithLongClientName(){ | ||
ScopeApproval scopeApproval = new ScopeApproval(); | ||
scopeApproval.setScope("Test"); | ||
scopeApproval.setStatus(ScopeApproval.ApprovalStatus.APPROVED); | ||
scopeApproval.setClientId("very-long-client-very-long-client-very-long-client-very-long-client-very-long-client-very-long-client"); | ||
TestObserver<ScopeApproval> testObserver = scopeApprovalRepository.create(scopeApproval).test(); | ||
testObserver.awaitDone(10, TimeUnit.SECONDS); | ||
testObserver.assertComplete(); | ||
testObserver.assertNoErrors(); | ||
} | ||
} |