Logic Machine Forum
Copy Trends - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Copy Trends (/showthread.php?tid=5588)



Copy Trends - jmir - 30.08.2024

Hi, Is there any way to export trend logs from a LM and import them to another one? I mean exiting data and trend config.


RE: Copy Trends - admin - 30.08.2024

1. Make a backup on destination LM in case something goes wrong

2. Make a backup on source LM

3. Open the backup archive using 7-Zip (https://www.7-zip.org/) and extract storage/db/current.db

4. Open current.db using DB Browser for SQLite (https://sqlitebrowser.org/)

5. Open File > Export > Database to SQL file...

6. Click "Deselect all" then select only trends table

7. Check "Keep column names..." and select "Export data only"

8. Save the file as trends.sql and open it in any text editor

9. Remove first and last line ("BEGIN TRANSACTION;" and "COMMIT;")

10. Wrap each line starting with "INSERT" like this:
Code:
db:query([[INSERT INTO "trends"...]])

11. Delete all trends on destination LM

12. Copy the whole trends.sql file contents and run it as a script on destination LM

13. Refresh the UI and make sure that trends list hes been updated

14. Make a new backup on destination LM

15. Using 7-Zip copy storage/db/trends from source LM backup to destination LM backup

16. Restore the modified backup on destination LM


RE: Copy Trends - jmir - 02.09.2024

(30.08.2024, 06:34)admin Wrote: 1. Make a backup on destination LM in case something goes wrong

2. Make a backup on source LM

3. Open the backup archive using 7-Zip (https://www.7-zip.org/) and extract storage/db/current.db

4. Open current.db using DB Browser for SQLite (https://sqlitebrowser.org/)

5. Open File > Export > Database to SQL file...

6. Click "Deselect all" then select only trends table

7. Check "Keep column names..." and select "Export data only"

8. Save the file as trends.sql and open it in any text editor

9. Remove first and last line ("BEGIN TRANSACTION;" and "COMMIT;")

10. Wrap each line starting with "INSERT" like this:
Code:
db:query([[INSERT INTO "trends"...]])

11. Delete all trends on destination LM

12. Copy the whole trends.sql file contents and run it as a script on destination LM

13. Refresh the UI and make sure that trends list hes been updated

14. Make a new backup on destination LM

15. Using 7-Zip copy storage/db/trends from source LM backup to destination LM backup

16. Restore the modified backup on destination LM

It works prefectly! Thanks!