Skip to content

Commit

Permalink
Db migration from save to cosv (#2927)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheshiriks authored Feb 27, 2024
1 parent b710b4d commit 9ac8f10
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions cosv-backend/db/db.changelog-cosv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@

<include file="tables/_all_changelogs.xml" relativeToChangelogFile="true"/>
<include file="test-data/db.changelog-insert.xml" relativeToChangelogFile="true" context="dev"/>
<include file="migration/_db.changelog-migration.xml" relativeToChangelogFile="true" context="prod"/>

</databaseChangeLog>
14 changes: 14 additions & 0 deletions cosv-backend/db/migration/_db.changelog-migration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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-3.8.xsd">

<include file="migration-from-save-to-cosv.xml" relativeToChangelogFile="true"/>

<changeSet id="migration" author="frolov">
<tagDatabase tag="migration"/>
</changeSet>

</databaseChangeLog>
21 changes: 21 additions & 0 deletions cosv-backend/db/migration/migration-from-save-to-cosv.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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-3.8.xsd">


<changeSet id="migration-from-save-to-cosv" author="frolov" context="prod">
<sql>
insert into cosv.cosv_file select * from save_cloud.cosv_file;
insert into cosv.raw_cosv_file select * from save_cloud.raw_cosv_file;
insert into cosv.cosv_generated_id select * from save_cloud.cosv_generated_id;
insert into cosv.vulnerability_metadata select * from save_cloud.vulnerability_metadata;
insert into cosv.vulnerability_metadata_project select * from save_cloud.vulnerability_metadata_project;
insert into cosv.lnk_vulnerability_metadata_tag select * from save_cloud.lnk_vulnerability_metadata_tag;
insert into cosv.lnk_vulnerability_metadata_user select * from save_cloud.lnk_vulnerability_metadata_user;
</sql>
</changeSet>

</databaseChangeLog>

0 comments on commit 9ac8f10

Please sign in to comment.