-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[backend] fix pause computation in inject start date (#2282)
Signed-off-by: Antoine MAZEAS <[email protected]>
- Loading branch information
1 parent
d47e0fe
commit be37ea6
Showing
2 changed files
with
52 additions
and
21 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
openbas-api/src/main/java/io/openbas/migration/V3_62__make_exercise_pause_tz_aware.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.openbas.migration; | ||
|
||
import java.sql.Connection; | ||
import java.sql.Statement; | ||
import org.flywaydb.core.api.migration.BaseJavaMigration; | ||
import org.flywaydb.core.api.migration.Context; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class V3_62__make_exercise_pause_tz_aware extends BaseJavaMigration { | ||
|
||
@Override | ||
public void migrate(Context context) throws Exception { | ||
Connection connection = context.getConnection(); | ||
Statement statement = connection.createStatement(); | ||
|
||
statement.execute( | ||
""" | ||
ALTER TABLE exercises ADD COLUMN exercise_pause_date_tempwithtz TIMESTAMP WITH TIME ZONE; | ||
UPDATE exercises SET exercise_pause_date_tempwithtz = exercise_pause_date; | ||
ALTER TABLE exercises DROP COLUMN exercise_pause_date; | ||
ALTER TABLE exercises RENAME COLUMN exercise_pause_date_tempwithtz TO exercise_pause_date; | ||
"""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters