wso2 is change the embedded database schema

2019-09-11 01:19发布

问题:

I am working with the WSO2 IS 5.2.0

for some reasons, I would like to change the data schema of the default embedded H2 database.

for example, the maximum length of volume "ACCESS_TOKEN" in table "IDN_OAUTH2_ACCESS_TOKEN" is 255 chars. I would like to change it to 8194.

I made the following change the configuration file "/dbscripts/identity/h2.sql" (see the value "8194")

CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN (
            TOKEN_ID VARCHAR (255),
            ACCESS_TOKEN VARCHAR (8194),
            REFRESH_TOKEN VARCHAR (255),
            CONSUMER_KEY_ID INTEGER,
            AUTHZ_USER VARCHAR (100),
            TENANT_ID INTEGER,
            USER_DOMAIN VARCHAR(50),
            USER_TYPE VARCHAR (25),
            GRANT_TYPE VARCHAR (50),
            TIME_CREATED TIMESTAMP DEFAULT 0,
            REFRESH_TOKEN_TIME_CREATED TIMESTAMP DEFAULT 0,
            VALIDITY_PERIOD BIGINT,
            REFRESH_TOKEN_VALIDITY_PERIOD BIGINT,
            TOKEN_SCOPE_HASH VARCHAR (32),
            TOKEN_STATE VARCHAR (25) DEFAULT 'ACTIVE',
            TOKEN_STATE_ID VARCHAR (128) DEFAULT 'NONE',
            SUBJECT_IDENTIFIER VARCHAR(255),
            PRIMARY KEY (TOKEN_ID),
            FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE,
            CONSTRAINT CON_APP_KEY UNIQUE (CONSUMER_KEY_ID,AUTHZ_USER,TENANT_ID,USER_DOMAIN,USER_TYPE,TOKEN_SCOPE_HASH,
                                           TOKEN_STATE,TOKEN_STATE_ID)

the problems is that I just cannot put this change into effect. I did everything (restart, reinstall), the original settings ("256") persists...

it seems that the database schema had been generated in the IS server image. and the generating script file says "GENERATE IF NOT EXISTS..."

anyone has any idea?

thanks

回答1:

Remove <IS_HOME>/repository/database/*. Then start server with -Dsetup.

./wso2server.sh -Dsetup


回答2:

Yes, It is generated with the server distribution. What you can do is (backup and) remove the content of repository/database, update the db scripts and start the server with bin/wso2server.sh -Dsetup. This needs to be done only once, from next time on you can start the server as usual.

One other possibility is to use the H2 console. If you already have data, it will be the better option.



标签: wso2 h2 wso2is