[DEV] add save of file move
This commit is contained in:
parent
bd66703a08
commit
93b95becb7
@ -1,5 +1,7 @@
|
||||
package org.kar.karideo.migration;
|
||||
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.nio.file.Paths;
|
||||
@ -14,6 +16,7 @@ import org.kar.archidata.dataAccess.DBAccess;
|
||||
import org.kar.archidata.dataAccess.options.AccessDeletedItems;
|
||||
import org.kar.archidata.dataAccess.options.OverrideTableName;
|
||||
import org.kar.archidata.migration.MigrationSqlStep;
|
||||
import org.kar.archidata.tools.ConfigBaseVariable;
|
||||
import org.kar.karideo.migration.model.CoverConversion;
|
||||
import org.kar.karideo.migration.model.MediaConversion;
|
||||
import org.kar.karideo.migration.model.OIDConversion;
|
||||
@ -102,17 +105,24 @@ public class Migration20250214 extends MigrationSqlStep {
|
||||
""");
|
||||
// Move the files...
|
||||
addAction((final DBAccess da) -> {
|
||||
final List<OIDConversion> datas = da.gets(OIDConversion.class, new AccessDeletedItems(), new OverrideTableName("data"));
|
||||
for (final OIDConversion data : datas) {
|
||||
final String origin = DataResource.getFileDataOld(data.uuid);
|
||||
final String destination = DataResource.getFileData(data._id);
|
||||
LOGGER.info("move file = {}", origin);
|
||||
LOGGER.info(" ==> {}", destination);
|
||||
try {
|
||||
Files.move(Paths.get(origin), Paths.get(destination), StandardCopyOption.ATOMIC_MOVE);
|
||||
} catch (final NoSuchFileException ex) {
|
||||
LOGGER.warn("Fail to move file : {}", ex.getMessage());
|
||||
final String filePath = ConfigBaseVariable.getMediaDataFolder() + "/Migration20250214.txt";
|
||||
try (FileWriter writer = new FileWriter(filePath, true)) {
|
||||
final List<OIDConversion> datas = da.gets(OIDConversion.class, new AccessDeletedItems(), new OverrideTableName("data"));
|
||||
for (final OIDConversion data : datas) {
|
||||
final String origin = DataResource.getFileDataOld(data.uuid);
|
||||
final String destination = DataResource.getFileData(data._id);
|
||||
LOGGER.info("move file = {}", origin);
|
||||
LOGGER.info(" ==> {}", destination);
|
||||
try {
|
||||
Files.move(Paths.get(origin), Paths.get(destination), StandardCopyOption.ATOMIC_MOVE);
|
||||
} catch (final NoSuchFileException ex) {
|
||||
LOGGER.warn("Fail to move file : {}", ex.getMessage());
|
||||
}
|
||||
writer.write(origin + " | " + destination + "\n");
|
||||
writer.flush();
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
addAction("""
|
||||
|
@ -64,23 +64,23 @@
|
||||
"@testing-library/user-event": "14.6.1",
|
||||
"@trivago/prettier-plugin-sort-imports": "5.2.2",
|
||||
"@types/jest": "29.5.14",
|
||||
"@types/node": "22.13.4",
|
||||
"@types/node": "22.13.5",
|
||||
"@types/react": "19.0.10",
|
||||
"@types/react-dom": "19.0.4",
|
||||
"@typescript-eslint/eslint-plugin": "8.24.1",
|
||||
"@typescript-eslint/parser": "8.24.1",
|
||||
"@vitejs/plugin-react": "4.3.4",
|
||||
"eslint": "9.20.1",
|
||||
"eslint": "9.21.0",
|
||||
"eslint-plugin-import": "2.31.0",
|
||||
"eslint-plugin-react": "7.37.4",
|
||||
"eslint-plugin-react-hooks": "5.1.0",
|
||||
"eslint-plugin-storybook": "0.11.3",
|
||||
"jest": "29.7.0",
|
||||
"jest-environment-jsdom": "29.7.0",
|
||||
"knip": "5.44.4",
|
||||
"knip": "5.44.5",
|
||||
"lint-staged": "15.4.3",
|
||||
"npm-check-updates": "^17.1.14",
|
||||
"prettier": "3.5.1",
|
||||
"npm-check-updates": "^17.1.15",
|
||||
"prettier": "3.5.2",
|
||||
"puppeteer": "24.2.1",
|
||||
"react-is": "19.0.0",
|
||||
"storybook": "8.5.8",
|
||||
|
474
front/pnpm-lock.yaml
generated
474
front/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user