From ef94923bf165c8ee353fbf52eed2da6dd545e6b4 Mon Sep 17 00:00:00 2001 From: Oscar Beaumont Date: Tue, 25 Oct 2022 06:53:24 +1000 Subject: [PATCH] fix database migrations --- apps/desktop/package.json | 3 +- .../migration.sql | 40 ++++++++++++++++++ pnpm-lock.yaml | Bin 814892 -> 813218 bytes 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 core/prisma/migrations/20221024204936_fix_migrations/migration.sql diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 72dc6a031..6d3187854 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -8,7 +8,8 @@ "vite": "vite", "dev": "tauri dev", "tauri": "tauri", - "build": "tauri build" + "build": "tauri build", + "dmg": "open ../../target/release/bundle/dmg/" }, "dependencies": { "@rspc/tauri": "^0.0.0-main-7c0a67c1", diff --git a/core/prisma/migrations/20221024204936_fix_migrations/migration.sql b/core/prisma/migrations/20221024204936_fix_migrations/migration.sql new file mode 100644 index 000000000..12bb46a7f --- /dev/null +++ b/core/prisma/migrations/20221024204936_fix_migrations/migration.sql @@ -0,0 +1,40 @@ +/* + Warnings: + + - You are about to drop the column `checksum` on the `key` table. All the data in the column will be lost. + - You are about to alter the column `algorithm` on the `key` table. The data in that column could be lost. The data in that column will be cast from `Int` to `Binary`. + - Added the required column `content_salt` to the `key` table without a default value. This is not possible if the table is not empty. + - Added the required column `default` to the `key` table without a default value. This is not possible if the table is not empty. + - Added the required column `hashing_algorithm` to the `key` table without a default value. This is not possible if the table is not empty. + - Added the required column `key` to the `key` table without a default value. This is not possible if the table is not empty. + - Added the required column `key_nonce` to the `key` table without a default value. This is not possible if the table is not empty. + - Added the required column `master_key` to the `key` table without a default value. This is not possible if the table is not empty. + - Added the required column `master_key_nonce` to the `key` table without a default value. This is not possible if the table is not empty. + - Added the required column `salt` to the `key` table without a default value. This is not possible if the table is not empty. + - Added the required column `uuid` to the `key` table without a default value. This is not possible if the table is not empty. + - Made the column `algorithm` on table `key` required. This step will fail if there are existing NULL values in that column. + +*/ +-- RedefineTables +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_key" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "uuid" TEXT NOT NULL, + "name" TEXT, + "default" BOOLEAN NOT NULL, + "date_created" DATETIME DEFAULT CURRENT_TIMESTAMP, + "algorithm" BLOB NOT NULL, + "hashing_algorithm" BLOB NOT NULL, + "salt" BLOB NOT NULL, + "content_salt" BLOB NOT NULL, + "master_key" BLOB NOT NULL, + "master_key_nonce" BLOB NOT NULL, + "key_nonce" BLOB NOT NULL, + "key" BLOB NOT NULL +); +INSERT INTO "new_key" ("algorithm", "date_created", "id", "name") SELECT "algorithm", "date_created", "id", "name" FROM "key"; +DROP TABLE "key"; +ALTER TABLE "new_key" RENAME TO "key"; +CREATE UNIQUE INDEX "key_uuid_key" ON "key"("uuid"); +PRAGMA foreign_key_check; +PRAGMA foreign_keys=ON; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d8f97758e96e8be2a69101414b0df68f8b77c3ce..06a65226d4cfc24da26cd773f6b5c610365c9b69 100644 GIT binary patch delta 825 zcmY*XTS!z<6y@wY&YU^(aMa=UQX5}^q%+qCp@w8XCYeGIL_v~;nSI0hl6e-j7PB{2+IA`y*H*4*^PT#w%dvjTX zPm<7M6+3ScD;~~FPP60Pw^G#b8RZRAb91(;Gx14yVhJ4Ta^hZ`U4-q;^Vu|?&Hgs) zZKK2j46m<9N%Uuo-F&YPBMHs&23m6d3wbyY;N{rT z1@YMQ2n3ZpfGGo>Ldc^-eXz=~t_M;{gQ}VJLRIDIx}vN+x8hb*S7o8zOWlJ|7UtFo zQ6n@``Vc4vT^fFvfPC_e!b~{UCcH$-I5dL}lLnh0q8B|ruwcR%n8-Z|`=yPopko5! zRDW_6hDKpGU7do9vWO_cq(+vB{$6lmsVvNG6$?NW3)1%(W4H#_jMhWw{VX}uV4jJd ztw?37xVCJFAu6F`B_X4 z@Lj09;4%$N@=hCW3-V~H3G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