Skip to content

Commit 88dd321

Browse files
missing rollback instructions
1 parent 2df8360 commit 88dd321

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/main/resources/db/changelog/changesets/changelog_20240109T161028Z.xml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
22
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
33
<changeSet author="chuinetri" id="1704818243021-1">
4-
<comment>Deduplicate rows before adding unique constraint</comment>
4+
<comment>Deduplicate rows before adding unique constraints</comment>
55
<delete tableName="user_infos">
66
<where>id in (select id from (select row_number() over (partition by sub) as rnb, * from user_infos) subquery where rnb > 1)</where>
77
</delete>
88

99
<sql stripComments="true" dbms="!oracle">
1010
update connection c1 set
1111
first_connexion_date = (select min(c2.first_connexion_date) from connection c2 where c2.sub=c1.sub group by c2.sub),
12-
last_connexion_date = (select max(c2.last_connexion_date) from connection c2 where c2.sub=c1.sub group by c2.sub),
13-
connection_accepted = (select connection_accepted from connection c2 where (c2.sub, c2.last_connexion_date) in (
12+
last_connexion_date = (select max(c2.last_connexion_date) from connection c2 where c2.sub=c1.sub group by c2.sub),
13+
connection_accepted = (select connection_accepted from connection c2 where (c2.sub, c2.last_connexion_date) in (
1414
select c3.sub, max(c3.last_connexion_date) from connection c3 where c3.sub=c1.sub group by c3.sub) limit 1);
1515
</sql>
1616
<sql stripComments="true" dbms="oracle">
1717
--oracle use fetch instead of limit
1818
update connection c1 set
19-
first_connexion_date = (select min(c2.first_connexion_date) from connection c2 where c2.sub=c1.sub group by c2.sub),
20-
last_connexion_date = (select max(c2.last_connexion_date) from connection c2 where c2.sub=c1.sub group by c2.sub),
21-
connection_accepted = (select connection_accepted from connection c2 where (c2.sub, c2.last_connexion_date) in (
22-
select c3.sub, max(c3.last_connexion_date) from connection c3 where c3.sub=c1.sub group by c3.sub) FETCH FIRST 1 ROW ONLY);
19+
first_connexion_date = (select min(c2.first_connexion_date) from connection c2 where c2.sub=c1.sub group by c2.sub),
20+
last_connexion_date = (select max(c2.last_connexion_date) from connection c2 where c2.sub=c1.sub group by c2.sub),
21+
connection_accepted = (select connection_accepted from connection c2 where (c2.sub, c2.last_connexion_date) in (
22+
select c3.sub, max(c3.last_connexion_date) from connection c3 where c3.sub=c1.sub group by c3.sub) FETCH FIRST 1 ROW ONLY);
2323
</sql>
2424
<delete tableName="connection">
2525
<where>id in (select id from (select row_number() over (partition by sub) as rnb, * from connection) subquery where rnb > 1)</where>
2626
</delete>
27+
28+
<rollback/><!--no rollback possible because delete, but no need as we just removed duplicate records-->
2729
</changeSet>
2830

2931
<changeSet author="chuinetri" id="1704818243021-2">

0 commit comments

Comments
 (0)