mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
Desktop, Cli, Mobile: Migrate profile in preparation for trash feature
This commit is contained in:
parent
012fe0fb44
commit
115eb5defb
@ -801,6 +801,7 @@ packages/lib/services/database/migrations/42.js
|
||||
packages/lib/services/database/migrations/43.js
|
||||
packages/lib/services/database/migrations/44.js
|
||||
packages/lib/services/database/migrations/45.js
|
||||
packages/lib/services/database/migrations/46.js
|
||||
packages/lib/services/database/migrations/index.js
|
||||
packages/lib/services/database/sqlStringToLines.js
|
||||
packages/lib/services/database/types.js
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -781,6 +781,7 @@ packages/lib/services/database/migrations/42.js
|
||||
packages/lib/services/database/migrations/43.js
|
||||
packages/lib/services/database/migrations/44.js
|
||||
packages/lib/services/database/migrations/45.js
|
||||
packages/lib/services/database/migrations/46.js
|
||||
packages/lib/services/database/migrations/index.js
|
||||
packages/lib/services/database/sqlStringToLines.js
|
||||
packages/lib/services/database/types.js
|
||||
|
26
packages/lib/services/database/migrations/46.ts
Normal file
26
packages/lib/services/database/migrations/46.ts
Normal file
@ -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
|
||||
`,
|
||||
];
|
||||
};
|
@ -3,6 +3,7 @@ import migration42 from './42';
|
||||
import migration43 from './43';
|
||||
import migration44 from './44';
|
||||
import migration45 from './45';
|
||||
import migration46 from './46';
|
||||
|
||||
import { Migration } from '../types';
|
||||
|
||||
@ -11,6 +12,7 @@ const index: Migration[] = [
|
||||
migration43,
|
||||
migration44,
|
||||
migration45,
|
||||
migration46,
|
||||
];
|
||||
|
||||
export default index;
|
||||
|
@ -76,58 +76,6 @@ interface DatabaseTables {
|
||||
[key: string]: DatabaseTable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// AUTO-GENERATED BY packages/tools/generate-database-types.js
|
||||
|
||||
/*
|
||||
@ -150,6 +98,7 @@ export interface DeletedItemEntity {
|
||||
}
|
||||
export interface FolderEntity {
|
||||
'created_time'?: number;
|
||||
'deleted_time'?: number;
|
||||
'encryption_applied'?: number;
|
||||
'encryption_cipher_text'?: string;
|
||||
'icon'?: string;
|
||||
@ -272,6 +221,7 @@ export interface NoteEntity {
|
||||
'body'?: string;
|
||||
'conflict_original_id'?: string;
|
||||
'created_time'?: number;
|
||||
'deleted_time'?: number;
|
||||
'encryption_applied'?: number;
|
||||
'encryption_cipher_text'?: string;
|
||||
'id'?: string | null;
|
||||
@ -425,6 +375,7 @@ export interface VersionEntity {
|
||||
export const databaseSchema: DatabaseTables = {
|
||||
folders: {
|
||||
created_time: { type: 'number' },
|
||||
deleted_time: { type: 'number' },
|
||||
encryption_applied: { type: 'number' },
|
||||
encryption_cipher_text: { type: 'string' },
|
||||
icon: { type: 'string' },
|
||||
@ -605,6 +556,7 @@ export const databaseSchema: DatabaseTables = {
|
||||
body: { type: 'string' },
|
||||
conflict_original_id: { type: 'string' },
|
||||
created_time: { type: 'number' },
|
||||
deleted_time: { type: 'number' },
|
||||
encryption_applied: { type: 'number' },
|
||||
encryption_cipher_text: { type: 'string' },
|
||||
id: { type: 'string' },
|
||||
@ -646,15 +598,6 @@ export const databaseSchema: DatabaseTables = {
|
||||
user_updated_time: { type: 'number' },
|
||||
type_: { type: 'number' },
|
||||
},
|
||||
tags_with_note_count: {
|
||||
created_time: { type: 'number' },
|
||||
id: { type: 'string' },
|
||||
note_count: { type: 'any' },
|
||||
title: { type: 'string' },
|
||||
todo_completed_count: { type: 'any' },
|
||||
updated_time: { type: 'number' },
|
||||
type_: { type: 'number' },
|
||||
},
|
||||
items_normalized: {
|
||||
body: { type: 'string' },
|
||||
id: { type: 'number' },
|
||||
@ -709,4 +652,13 @@ export const databaseSchema: DatabaseTables = {
|
||||
value: { type: 'any' },
|
||||
type_: { type: 'number' },
|
||||
},
|
||||
tags_with_note_count: {
|
||||
created_time: { type: 'number' },
|
||||
id: { type: 'string' },
|
||||
note_count: { type: 'any' },
|
||||
title: { type: 'string' },
|
||||
todo_completed_count: { type: 'any' },
|
||||
updated_time: { type: 'number' },
|
||||
type_: { type: 'number' },
|
||||
},
|
||||
};
|
@ -3,7 +3,7 @@
|
||||
import { Size } from './types';
|
||||
|
||||
// AUTO-GENERATED by generate-database-type
|
||||
type ListRendererDatabaseDependency = 'folder.created_time' | 'folder.encryption_applied' | 'folder.encryption_cipher_text' | 'folder.icon' | 'folder.id' | 'folder.is_shared' | 'folder.master_key_id' | 'folder.parent_id' | 'folder.share_id' | 'folder.title' | 'folder.updated_time' | 'folder.user_created_time' | 'folder.user_data' | 'folder.user_updated_time' | 'folder.type_' | 'note.altitude' | 'note.application_data' | 'note.author' | 'note.body' | 'note.conflict_original_id' | 'note.created_time' | 'note.encryption_applied' | 'note.encryption_cipher_text' | 'note.id' | 'note.is_conflict' | 'note.is_shared' | 'note.is_todo' | 'note.latitude' | 'note.longitude' | 'note.markup_language' | 'note.master_key_id' | 'note.order' | 'note.parent_id' | 'note.share_id' | 'note.source' | 'note.source_application' | 'note.source_url' | 'note.title' | 'note.todo_completed' | 'note.todo_due' | 'note.updated_time' | 'note.user_created_time' | 'note.user_data' | 'note.user_updated_time' | 'note.type_';
|
||||
type ListRendererDatabaseDependency = 'folder.created_time' | 'folder.deleted_time' | 'folder.encryption_applied' | 'folder.encryption_cipher_text' | 'folder.icon' | 'folder.id' | 'folder.is_shared' | 'folder.master_key_id' | 'folder.parent_id' | 'folder.share_id' | 'folder.title' | 'folder.updated_time' | 'folder.user_created_time' | 'folder.user_data' | 'folder.user_updated_time' | 'folder.type_' | 'note.altitude' | 'note.application_data' | 'note.author' | 'note.body' | 'note.conflict_original_id' | 'note.created_time' | 'note.deleted_time' | 'note.encryption_applied' | 'note.encryption_cipher_text' | 'note.id' | 'note.is_conflict' | 'note.is_shared' | 'note.is_todo' | 'note.latitude' | 'note.longitude' | 'note.markup_language' | 'note.master_key_id' | 'note.order' | 'note.parent_id' | 'note.share_id' | 'note.source' | 'note.source_application' | 'note.source_url' | 'note.title' | 'note.todo_completed' | 'note.todo_due' | 'note.updated_time' | 'note.user_created_time' | 'note.user_data' | 'note.user_updated_time' | 'note.type_';
|
||||
// AUTO-GENERATED by generate-database-type
|
||||
|
||||
export enum ItemFlow {
|
||||
|
@ -554,6 +554,7 @@ share_id: ${note.share_id || ''}
|
||||
conflict_original_id:
|
||||
master_key_id:
|
||||
user_data:
|
||||
deleted_time: 0
|
||||
type_: 1`;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user