Skip to content

Commit

Permalink
Fix #1548: OTP cannot be created without userId (#1549)
Browse files Browse the repository at this point in the history
(cherry picked from commit 2750b57)
  • Loading branch information
zcgandcomp committed Jan 17, 2024
1 parent b5a0564 commit b07ce34
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 1 deletion.
14 changes: 13 additions & 1 deletion docs/Web-Flow-1.6.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,16 @@

This guide contains instructions for migration from PowerAuth WebFlow version `1.5.x` to version `1.6.0`.

No migration steps nor database changes are required.
## Database Changes

For convenience you can use liquibase for your database migration.

For manual changes use SQL scripts:

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

### Fix DB Bug for Creating OTP without User ID

The column `user_id` in table `ns_otp_storage` is nullable now.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">

<changeSet id="1" logicalFilePath="powerauth-nextstep/1.6.x/20240116-add-tag-1.6.0.xml" author="Zdenek Cerny">
<tagDatabase tag="powerauth-nextstep/1.6.0"/>
</changeSet>

</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">

<changeSet id="1" logicalFilePath="powerauth-nextstep/1.6.x/20240116-correct-userid-nullable.xml" author="Zdenek Cerny">
<preConditions onFail="MARK_RAN">
<tableExists tableName="ns_otp_storage"/>
<columnExists tableName="ns_otp_storage" columnName="user_id"/>
</preConditions>
<comment>Make user_id column in table ns_otp_storage nullable</comment>
<dropNotNullConstraint tableName="ns_otp_storage" columnName="user_id" columnDataType="varchar(255)" />
</changeSet>

</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">

<include file="20240116-correct-userid-nullable.xml" relativeToChangelogFile="true" />
<include file="20240116-add-tag-1.6.0.xml" relativeToChangelogFile="true" />

</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@

<include file="1.4.x/db.changelog-version.xml" relativeToChangelogFile="true" />
<include file="1.5.x/db.changelog-version.xml" relativeToChangelogFile="true" />
<include file="1.6.x/db.changelog-version.xml" relativeToChangelogFile="true" />

</databaseChangeLog>
Empty file.
3 changes: 3 additions & 0 deletions docs/sql/postgresql/migration_1.5.1_1.6.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Changeset powerauth-nextstep/1.6.x/20240116-correct-userid-nullable.xml::1::Zdenek Cerny
-- Make user_id column in table ns_otp_storage nullable
ALTER TABLE ns_otp_storage ALTER COLUMN user_id DROP NOT NULL;

0 comments on commit b07ce34

Please sign in to comment.