Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Desktop, Cli, Mobile: Migrate profile in preparation for trash feature
- Loading branch information
Showing
7 changed files
with
45 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { SqlQuery } from '../types'; | ||
|
||
export default (): (SqlQuery|string)[] => { | ||
return [ | ||
'ALTER TABLE `notes` ADD COLUMN `deleted_time` INT NOT NULL DEFAULT 0', | ||
'ALTER TABLE `folders` ADD COLUMN `deleted_time` INT NOT NULL DEFAULT 0', | ||
'DROP VIEW tags_with_note_count', | ||
` | ||
CREATE VIEW tags_with_note_count AS | ||
SELECT | ||
tags.id as id, | ||
tags.title as title, | ||
tags.created_time as created_time, | ||
tags.updated_time as updated_time, | ||
COUNT(notes.id) as note_count, | ||
SUM(CASE WHEN notes.todo_completed > 0 THEN 1 ELSE 0 END) AS todo_completed_count | ||
FROM tags | ||
LEFT JOIN note_tags nt on nt.tag_id = tags.id | ||
LEFT JOIN notes on notes.id = nt.note_id | ||
WHERE | ||
notes.id IS NOT NULL | ||
AND notes.deleted_time = 0 | ||
GROUP BY tags.id | ||
`, | ||
]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters