Tamás Hanicz created KNOX-3521:
----------------------------------

             Summary: Existing database tables are not upgraded when new 
columns are added
                 Key: KNOX-3521
                 URL: https://issues.apache.org/jira/browse/KNOX-3521
             Project: Apache Knox
          Issue Type: Improvement
          Components: Server
    Affects Versions: 3.1.0
            Reporter: Tamás Hanicz
            Assignee: Tamás Hanicz


At startup, Knox creates its tables (token state, remote config, KnoxIDF 
federated identity, trusted OIDC issuers, delegation policy) from the 
create*.sql scripts in gateway-server. It does this through 
KnoxDatabase.createTableIfNotExists / createTablesIfNotExist. The only check is 
whether the table exists. If it already exists, the script is skipped and the 
columns are never compared.

So when a release adds a column to an existing table's DDL, installations that 
upgrade keep the old table without the column. Any query that names the column 
fails at runtime.

For example, KNOX-3512 added jwks_ca to TRUSTED_OIDC_ISSUERS. A database whose 
table was created before that change has no jwks_ca column, so the INSERT and 
SELECT in TrustedOidcIssuerDatabase fail after the upgrade.

The fix has to work on every supported database: PostgreSQL, MySQL, MariaDB, 
Oracle and H2.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to