diff --git a/docs-private/Developer-How-To-Start.md b/docs-private/Developer-How-To-Start.md index e7f651361..a9808b504 100644 --- a/docs-private/Developer-How-To-Start.md +++ b/docs-private/Developer-How-To-Start.md @@ -25,11 +25,27 @@ liquibase --changelog-file=./docs/db/changelog/changesets/powerauth-java-server/ To generate SQL script run this command. +#### Oracle + ```shell liquibase --changeLogFile=./docs/db/changelog/changesets/powerauth-java-server/db.changelog-module.xml --output-file=./docs/sql/oracle/generated-oracle-script.sql updateSQL --url=offline:oracle ``` +#### MS SQL + +```shell +liquibase --changeLogFile=./docs/db/changelog/changesets/powerauth-java-server/db.changelog-module.xml --output-file=./docs/sql/mssql/generated-mssql-script.sql updateSQL --url=offline:mssql +``` + + +#### PostgreSQL + +```shell +liquibase --changeLogFile=./docs/db/changelog/changesets/powerauth-java-server/db.changelog-module.xml --output-file=./docs/sql/postgresql/generated-postgresql-script.sql updateSQL --url=offline:postgres +``` + + ## PowerAuth Admin Server diff --git a/docs/Database-Structure.md b/docs/Database-Structure.md index de4fe9ae4..56fa10783 100644 --- a/docs/Database-Structure.md +++ b/docs/Database-Structure.md @@ -140,7 +140,7 @@ CREATE TABLE pa_activation device_info VARCHAR(255), flags VARCHAR(255), external_id VARCHAR(255), - protocol VARCHAR(32) DEFAULT 'powerauth', + protocol VARCHAR(32) DEFAULT 'powerauth' NOT NULL, failed_attempts INTEGER NOT NULL, max_failed_attempts INTEGER DEFAULT 5 NOT NULL, server_private_key_base64 VARCHAR(255) NOT NULL, diff --git a/docs/db/changelog/changesets/powerauth-java-server/1.7.x/20240115-add-columns-fido2.xml b/docs/db/changelog/changesets/powerauth-java-server/1.7.x/20240115-add-columns-fido2.xml index 5a9a77f08..600d7b9dc 100644 --- a/docs/db/changelog/changesets/powerauth-java-server/1.7.x/20240115-add-columns-fido2.xml +++ b/docs/db/changelog/changesets/powerauth-java-server/1.7.x/20240115-add-columns-fido2.xml @@ -49,4 +49,17 @@ + + + + + protocol is null + + + + + Make column pa_activation.protocol not-null. + + + diff --git a/docs/sql/mssql/migration_1.6.0_1.7.0.sql b/docs/sql/mssql/migration_1.6.0_1.7.0.sql index 31355ec25..9b221a3f6 100644 --- a/docs/sql/mssql/migration_1.6.0_1.7.0.sql +++ b/docs/sql/mssql/migration_1.6.0_1.7.0.sql @@ -12,6 +12,15 @@ GO ALTER TABLE pa_activation ALTER COLUMN extras varchar (4000); GO +-- Changeset powerauth-java-server/1.7.x/20240115-add-columns-fido2::4::Lubos Racansky +UPDATE pa_activation SET protocol = 'powerauth' WHERE protocol is null; +GO + +-- Changeset powerauth-java-server/1.7.x/20240530-protocol-not-null.xml::5::Lubos Racansky +-- Make column pa_activation.protocol not-null. +ALTER TABLE pa_activation ALTER COLUMN protocol varchar(32) NOT NULL; +GO + -- Changeset powerauth-java-server/1.7.x/20240212-application-config.xml::1::Roman Strobl -- Create a new table pa_application_config CREATE TABLE pa_application_config (id int NOT NULL, application_id int NOT NULL, config_key varchar(255) NOT NULL, config_values varchar (max), CONSTRAINT PK_PA_APPLICATION_CONFIG PRIMARY KEY (id), CONSTRAINT pa_app_config_app_fk FOREIGN KEY (application_id) REFERENCES pa_application(id)); diff --git a/docs/sql/oracle/migration_1.6.0_1.7.0.sql b/docs/sql/oracle/migration_1.6.0_1.7.0.sql index 94bddbd38..826a27d67 100644 --- a/docs/sql/oracle/migration_1.6.0_1.7.0.sql +++ b/docs/sql/oracle/migration_1.6.0_1.7.0.sql @@ -9,6 +9,13 @@ ALTER TABLE pa_activation ADD protocol VARCHAR2(32) DEFAULT 'powerauth'; -- Changeset powerauth-java-server/1.7.x/20240115-add-columns-fido2::3::Roman Strobl ALTER TABLE pa_activation MODIFY extras VARCHAR2(4000); +-- Changeset powerauth-java-server/1.7.x/20240115-add-columns-fido2::4::Lubos Racansky +UPDATE pa_activation SET protocol = 'powerauth' WHERE protocol is null; + +-- Changeset powerauth-java-server/1.7.x/20240530-protocol-not-null.xml::5::Lubos Racansky +-- Make column pa_activation.protocol not-null. +ALTER TABLE pa_activation MODIFY protocol NOT NULL; + -- Changeset powerauth-java-server/1.7.x/20240212-application-config.xml::1::Roman Strobl -- Create a new table pa_application_config CREATE TABLE pa_application_config (id INTEGER NOT NULL, application_id INTEGER NOT NULL, config_key VARCHAR2(255) NOT NULL, config_values CLOB, CONSTRAINT PK_PA_APPLICATION_CONFIG PRIMARY KEY (id), CONSTRAINT pa_app_config_app_fk FOREIGN KEY (application_id) REFERENCES pa_application(id)); diff --git a/docs/sql/postgresql/migration_1.6.0_1.7.0.sql b/docs/sql/postgresql/migration_1.6.0_1.7.0.sql index 29d852eea..1bd2dad39 100644 --- a/docs/sql/postgresql/migration_1.6.0_1.7.0.sql +++ b/docs/sql/postgresql/migration_1.6.0_1.7.0.sql @@ -9,6 +9,13 @@ ALTER TABLE pa_activation ADD protocol VARCHAR(32) DEFAULT 'powerauth'; -- Changeset powerauth-java-server/1.7.x/20240115-add-columns-fido2::3::Roman Strobl ALTER TABLE pa_activation ALTER COLUMN extras TYPE VARCHAR(4000) USING (extras::VARCHAR(4000)); +-- Changeset powerauth-java-server/1.7.x/20240115-add-columns-fido2::4::Lubos Racansky +UPDATE pa_activation SET protocol = 'powerauth' WHERE protocol is null; + +-- Changeset powerauth-java-server/1.7.x/20240530-protocol-not-null.xml::5::Lubos Racansky +-- Make column pa_activation.protocol not-null. +ALTER TABLE pa_activation ALTER COLUMN protocol SET NOT NULL; + -- Changeset powerauth-java-server/1.7.x/20240212-application-config.xml::1::Roman Strobl -- Create a new table pa_application_config CREATE TABLE pa_application_config (id INTEGER NOT NULL, application_id INTEGER NOT NULL, config_key VARCHAR(255) NOT NULL, config_values TEXT, CONSTRAINT pa_application_config_pkey PRIMARY KEY (id), CONSTRAINT pa_app_config_app_fk FOREIGN KEY (application_id) REFERENCES pa_application(id)); diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/database/model/entity/ActivationRecordEntity.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/database/model/entity/ActivationRecordEntity.java index a100886c1..8c548221a 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/database/model/entity/ActivationRecordEntity.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/database/model/entity/ActivationRecordEntity.java @@ -70,7 +70,7 @@ public class ActivationRecordEntity implements Serializable { @Column(name = "extras", columnDefinition = "CLOB") private String extras; - @Column(name = "protocol") + @Column(name = "protocol", nullable = false, columnDefinition = "varchar(32) default 'powerauth'") private String protocol; @Column(name = "platform")