fix migration script to preserve sync IDs

This commit is contained in:
zadam 2020-03-15 11:19:30 +01:00
parent 20c24e26cc
commit f5e27278ab
2 changed files with 10 additions and 10 deletions

View File

@ -6,8 +6,8 @@ CREATE TABLE IF NOT EXISTS "sync_mig" (
`isSynced` INTEGER default 0 not null,
`utcSyncDate` TEXT NOT NULL);
INSERT INTO sync_mig (entityName, entityId, sourceId, isSynced, utcSyncDate)
SELECT entityName, entityId, sourceId, 1, utcSyncDate FROM sync;
INSERT INTO sync_mig (id, entityName, entityId, sourceId, isSynced, utcSyncDate)
SELECT id, entityName, entityId, sourceId, 1, utcSyncDate FROM sync;
DROP TABLE sync;

View File

@ -3,8 +3,6 @@ CREATE TABLE IF NOT EXISTS "source_ids" (
`utcDateCreated` TEXT NOT NULL,
PRIMARY KEY(`sourceId`)
);
CREATE INDEX IDX_source_ids_utcDateCreated
on source_ids (utcDateCreated);
CREATE TABLE IF NOT EXISTS "api_tokens"
(
apiTokenId TEXT PRIMARY KEY NOT NULL,
@ -59,6 +57,8 @@ CREATE INDEX `IDX_note_revisions_utcDateCreated` ON `note_revisions` (`utcDateCr
CREATE INDEX `IDX_note_revisions_utcDateLastEdited` ON `note_revisions` (`utcDateLastEdited`);
CREATE INDEX `IDX_note_revisions_dateCreated` ON `note_revisions` (`dateCreated`);
CREATE INDEX `IDX_note_revisions_dateLastEdited` ON `note_revisions` (`dateLastEdited`);
CREATE INDEX IDX_source_ids_utcDateCreated
on source_ids (utcDateCreated);
CREATE TABLE IF NOT EXISTS "notes" (
`noteId` TEXT NOT NULL,
`title` TEXT NOT NULL DEFAULT "note",