Skip to content

Commit

Permalink
Fix #1247: FIDO2: Database migration instructions (#1249)
Browse files Browse the repository at this point in the history
  • Loading branch information
romanstrobl authored Jan 16, 2024
1 parent 18cf674 commit e1ae565
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/Migration-Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ This page contains PowerAuth Server migration instructions.
When updating across multiple versions, you need to perform all migration steps additively.
<!-- end -->

- [PowerAuth Server 1.7.0](./PowerAuth-Server-1.7.0.md)
- [PowerAuth Server 1.6.0](./PowerAuth-Server-1.6.0.md)
- [PowerAuth Server 1.5.0](./PowerAuth-Server-1.5.0.md)
- [PowerAuth Server 1.4.0](./PowerAuth-Server-1.4.0.md)
- [PowerAuth Server 1.3.0](./PowerAuth-Server-1.3.0.md)
Expand Down
21 changes: 21 additions & 0 deletions docs/PowerAuth-Server-1.7.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Migration from 1.6.x to 1.7.0

This guide contains instructions for migration from PowerAuth Server version `1.6.x` to version `1.7.0`.

## Database Changes

For convenience you can use liquibase for your database migration.

For manual changes use SQL scripts:

- [PostgreSQL script](./sql/postgresql/migration_1.6.0_1.7.0.sql)
- [Oracle script](./sql/oracle/migration_1.6.0_1.7.0.sql)
- [MSSQL script](./sql/mssql/migration_1.6.0_1.7.0.sql)

### Updated DB Schema for FIDO2 Support

Following columns have been added to table `pa_activation` for FIDO2 support:
- `external_id` - external identifier of the activation
- `protocol` - protocol enumeration: `powerauth` or `fido2`

The data type for column `extras` in table `pa_activation` was changed to `TEXT` / `CLOB` to support larger data.
13 changes: 13 additions & 0 deletions docs/sql/mssql/migration_1.6.0_1.7.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Changeset powerauth-java-server/1.7.x/20240115-add-columns-fido2::1::Roman Strobl
-- Add external_id column
ALTER TABLE pa_activation ADD external_id varchar(255);
GO

-- Changeset powerauth-java-server/1.7.x/20240115-add-columns-fido2::2::Roman Strobl
-- Add protocol column
ALTER TABLE pa_activation ADD protocol varchar(32) CONSTRAINT DF_pa_activation_protocol DEFAULT 'powerauth';
GO

-- Changeset powerauth-java-server/1.7.x/20240115-add-columns-fido2::3::Roman Strobl
ALTER TABLE pa_activation ALTER COLUMN extras varchar (max);
GO
10 changes: 10 additions & 0 deletions docs/sql/oracle/migration_1.6.0_1.7.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- Changeset powerauth-java-server/1.7.x/20240115-add-columns-fido2::1::Roman Strobl
-- Add external_id column
ALTER TABLE pa_activation ADD external_id VARCHAR2(255);

-- Changeset powerauth-java-server/1.7.x/20240115-add-columns-fido2::2::Roman Strobl
-- Add protocol column
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 CLOB;
11 changes: 11 additions & 0 deletions docs/sql/postgresql/migration_1.6.0_1.7.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Changeset powerauth-java-server/1.7.x/20240115-add-columns-fido2::1::Roman Strobl
-- Add external_id column
ALTER TABLE pa_activation ADD external_id VARCHAR(255);

-- Changeset powerauth-java-server/1.7.x/20240115-add-columns-fido2::2::Roman Strobl
-- Add protocol column
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 TEXT USING (extras::TEXT);

0 comments on commit e1ae565

Please sign in to comment.