Skip to content

Commit

Permalink
fix prisma migration not work
Browse files Browse the repository at this point in the history
  • Loading branch information
vincehi committed Jul 25, 2023
1 parent 0d39a0a commit 2bddefb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.0.0-development",
"scripts": {
"prisma-studio": "(cd src-tauri && npx prisma studio)",
"prisma-generate-rust": "(cd src-tauri && cargo prisma generate)",
"prisma-generate-rust": "npm run cargo -- prisma generate",
"cargo": "func() { (cd src-tauri && cargo \"$@\"); }; func",
"prisma-prepare-schema-js": "node -r dotenv/config tools/prisma-prepare-schema.js src-tauri/prisma/schema.prisma dotenv_config_path=src-tauri/.env",
"prisma-js": "npm run prisma-prepare-schema-js && npx prisma --",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Warnings:
- Added the required column `bpm` to the `File` table without a default value. This is not possible if the table is not empty.
- Added the required column `chordsKey` to the `File` table without a default value. This is not possible if the table is not empty.
- Added the required column `chordsScale` to the `File` table without a default value. This is not possible if the table is not empty.
- Added the required column `danceability` to the `File` table without a default value. This is not possible if the table is not empty.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_File" (
"path" TEXT NOT NULL PRIMARY KEY,
"name" TEXT NOT NULL,
"directoryPath" TEXT NOT NULL,
"bpm" REAL NOT NULL,
"danceability" REAL NOT NULL,
"chordsKey" TEXT NOT NULL,
"chordsScale" TEXT NOT NULL,
CONSTRAINT "File_directoryPath_fkey" FOREIGN KEY ("directoryPath") REFERENCES "Directory" ("path") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_File" ("directoryPath", "name", "path") SELECT "directoryPath", "name", "path" FROM "File";
DROP TABLE "File";
ALTER TABLE "new_File" RENAME TO "File";
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;
6 changes: 3 additions & 3 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ async fn main() {
.await
.unwrap();

#[cfg(debug_assertions)]
// #[cfg(debug_assertions)]
prisma_client._db_push().await.unwrap();
#[cfg(not(debug_assertions))]
prisma_client._migrate_deploy().await.unwrap();
// #[cfg(not(debug_assertions))]
// prisma_client._migrate_deploy().await.unwrap();

handle.manage(AppState { prisma_client })
});
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "pulp",
"version": "1.1.0"
"version": "1.0.6"
},
"tauri": {
"allowlist": {
Expand Down

0 comments on commit 2bddefb

Please sign in to comment.