philhanna / crossword

Crossword puzzle editor
MIT License
2 stars 0 forks source link

Database migration #155

Closed philhanna closed 1 year ago

philhanna commented 1 year ago

The JSON representation of grids and puzzles will change. Need to

  1. Save all the existing objects in pickle format in a backup database.
  2. Make the JSON changes (see issue #153)
  3. Restore existing grids and puzzles from backup database:
    • Table users can just be copied from backup - no JSON
    • Likewise table words
    • For table grids:
      • Read each grid from the backup table
      • Recreate the grid from the pickled representation
      • Get new JSON output
      • Insert newly created grid into main table
    • Same for table puzzles
philhanna commented 1 year ago

Done.

The new database can be tested with a change to the dbfile entry in .crossword.ini:

[DEFAULT]
#
# dbfile -  The fully qualified path to the crossword database.
#           This is an SQLite 3 database.
# See https://www.sqlite.org/index.html
#
dbfile=/home/saspeh/crossword.db 
#dbfile=/home/saspeh/crossword_new.db 
#
# log_level -   This must one of the following:
#               CRITICAL
#               ERROR
#               WARNING
#               INFO
#               DEBUG
#               NOTSET
# See https://docs.python.org/3.7/library/logging.html#levels
#
log_level=INFO