Notes + script for update

This commit is contained in:
Bryan Ashby 2020-11-29 16:47:03 -07:00
parent e05e8a2e35
commit c87ac8680a
No known key found for this signature in database
GPG Key ID: B49EB437951D2542
3 changed files with 49 additions and 0 deletions

View File

@ -39,6 +39,13 @@ Report your issue on Xibalba BBS, hop in #enigma-bbs on FreeNode and chat, or
]
}
```
* A set of database fixes were made that cause some records to be properly cleaned up when e.g. deleting a file. Existing `file.db` databases will need to be updated **manually**. Note that this applies to users upgrading within 0.0.12-beta as well:
1. **Make a backup of your file.db!**
2. Shut down ENiGMA.
3. From the enigma-bbs directory:
```
sqlite3 db/file.sqlite3 < ./misc/update/tables_update_2020-11-29.sql
```
# 0.0.10-alpha to 0.0.11-beta
* Node.js 12.x LTS is now in use. Follow standard Node.js upgrade procedures (e.g.: `nvm install 12 && nvm use 12`).

View File

@ -13,6 +13,7 @@ This document attempts to track **major** changes and additions in ENiGMA½. For
* Default file browser up/down/pageUp/pageDown scrolls description (e.g. FILE_ID.DIZ). If you want to expose this on an existing system see the `fileBaseListEntries` in the default `file_base.in.hjson` template.
* File base search has had an improvement to search term handling.
* `./oputil user group -group` to now accepts `~group` removing the need for special handling of the "-" character. #331
* A fix has been made to clean up old `file.db` entries when a file is removed. Previously stale records could be left or even recycled into new entries. Please see [UPGRADE.md](UPGRADE.md) for details on applying this fix (look for `tables_update_2020-11-29.sql`).
## 0.0.11-beta
* Upgraded from `alpha` to `beta` -- The software is far along and mature enough at this point!

View File

@ -0,0 +1,41 @@
PRAGMA foreign_keys=OFF;
BEGIN;
CREATE TABLE IF NOT EXISTS file_hash_tag_new (
hash_tag_id INTEGER NOT NULL,
file_id INTEGER NOT NULL,
UNIQUE(hash_tag_id, file_id),
FOREIGN KEY(file_id) REFERENCES file(file_id) ON DELETE CASCADE
);
INSERT INTO file_hash_tag_new SELECT * FROM file_hash_tag;
DROP TABLE file_hash_tag;
ALTER TABLE file_hash_tag_new RENAME TO file_hash_tag;
CREATE TABLE IF NOT EXISTS file_user_rating_new (
file_id INTEGER NOT NULL,
user_id INTEGER NOT NULL,
rating INTEGER NOT NULL,
UNIQUE(file_id, user_id),
FOREIGN KEY(file_id) REFERENCES file(file_id) ON DELETE CASCADE
);
INSERT INTO file_user_rating_new SELECT * FROM file_user_rating;
DROP TABLE file_user_rating;
ALTER TABLE file_user_rating_new RENAME TO file_user_rating;
CREATE TABLE IF NOT EXISTS file_web_serve_batch_new (
hash_id VARCHAR NOT NULL,
file_id INTEGER NOT NULL,
UNIQUE(hash_id, file_id),
FOREIGN KEY(file_id) REFERENCES file(file_id) ON DELETE CASCADE
);
INSERT INTO file_web_serve_batch_new SELECT * FROM file_web_serve_batch;
DROP TABLE file_web_serve_batch;
ALTER TABLE file_web_serve_batch_new RENAME TO file_web_serve_batch;
PRAGMA foreign_key_check;
COMMIT;
PRAGMA foreign_keys=ON;