chaisql / chai

Modern embedded SQL database
MIT License
1.56k stars 95 forks source link

add .restore command #461

Closed sashaostrikov closed 2 years ago

sashaostrikov commented 2 years ago

Restore command works exactly like genji restore ~and restarts the shell to open the database which was restored from the dump.~ and applies given dump to currently open database

~@asdine I also thought about adding a flag to decide whether:~ ~1) we want to restart the shell and go to restored database~ ~or~ ~2) stay in current database.~

~But probably I am trying to overthink this and option 1 (which is currently implemented) is fine~

codecov[bot] commented 2 years ago

Codecov Report

Merging #461 (18f5189) into main (a542be9) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #461   +/-   ##
=======================================
  Coverage   79.16%   79.16%           
=======================================
  Files         127      127           
  Lines       10718    10718           
=======================================
  Hits         8485     8485           
  Misses       1531     1531           
  Partials      702      702           

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

asdine commented 2 years ago

Thanks @sashaostrikov !

I don't think we need to reload the database actually, the role of restore is just to apply the given queries to the current database. We should basically:

sashaostrikov commented 2 years ago

@asdine PTAL, I've simplified the restore logic