Skip to content

Commit

Permalink
Fixed SQLITE database upgrade routine from v0 to v1
Browse files Browse the repository at this point in the history
  • Loading branch information
mfep committed Jan 23, 2024
1 parent 305d20c commit bc8329c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- Fixed SQLITE database upgrade routine from v0 to v1
5 changes: 4 additions & 1 deletion src/datafile/sqlite_datafile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ impl DiaryDataSqlite {
info_name TEXT UNIQUE NOT NULL,
info_value TEXT NOT NULL
);
ALTER TABLE Category ADD COLUMN hidden INTEGER NOT NULL;
ALTER TABLE Category ADD COLUMN hidden INTEGER NOT NULL DEFAULT 0;
COMMIT;",
)?;
insert_version_to_db(&self.connection)?;
Expand Down Expand Up @@ -485,6 +485,9 @@ mod tests {
category_id INTEGER NOT NULL REFERENCES Category(category_id) ON DELETE CASCADE,
PRIMARY KEY(category_id, date)
);
INSERT INTO Category (name, created_at) VALUES (\"test_category\", 101);
INSERT INTO DateEntry (date, created_at) VALUES (123, 101);
INSERT INTO EntryToCategories (date, category_id) VALUES (123, 1);
COMMIT;",
)
.unwrap();
Expand Down

0 comments on commit bc8329c

Please sign in to comment.