diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 60680abe..e722a9bc 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -208,6 +208,7 @@ dependencies = [ "sha2 0.10.9", "sqlx", "sysinfo", + "tar", "tauri", "tauri-build", "tauri-plugin-autostart", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 3a004773..f2dd320f 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -35,6 +35,7 @@ axum = { version = "0.7", features = ["json", "macros", "ws"] } tower-http = { version = "0.5", features = ["cors"] } sqlx = { version = "0.8", features = ["runtime-tokio", "tls-rustls", "postgres", "sqlite", "mysql", "json", "chrono", "uuid", "rust_decimal"] } flate2 = "1" +tar = "0.4" encoding_rs = "0.8" reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls-webpki-roots", "stream"] } futures = "0.3" diff --git a/src-tauri/src/db/migrations.rs b/src-tauri/src/db/migrations.rs new file mode 100644 index 00000000..3db78839 --- /dev/null +++ b/src-tauri/src/db/migrations.rs @@ -0,0 +1,235 @@ +// The migrations a Prisma or Drizzle project has on disk, for the Migrations +// page. What ran comes from the database (`_prisma_migrations`, +// `__drizzle_migrations`), read by the page with plain SELECTs; this side only +// reads the project folder, so the page can show what's still pending and spot +// a migration whose file changed after it ran. +// +// Prisma: `
+
No local servers yet
+Postgres, MySQL, MariaDB, Redis or MongoDB, any version, ready in a minute.
+{s.name}
++ {#if s.problem}{s.problem} + {:else}{e.label} {s.version} · {s.running ? `127.0.0.1:${s.port}` : `port ${s.port}`} · {runtimeLabel(s.runtime)}{/if} +
+{logs}
+ {:else}
+ + {c.applied} applied + {#if files}{c.pending} pending{/if} + {#if c.failed}{c.failed} failed{/if} + {#if c.rolledBack}{c.rolledBack} rolled back{/if} +
+ {/if} + + + +
+
+ Showing what ran. to see pending migrations too. +
+ {/if} + + {#if error} +Could not read the migrations table
+{error}
+No migrations in this database yet
+Neither _prisma_migrations nor __drizzle_migrations is here. Pick the project folder to see what would run.
+ {tool === 'prisma' ? 'No Prisma migrations' : 'No Drizzle migrations'} {rows === null ? 'in this database' : 'yet'}. +
+ {:else} ++ {[m.durationMs != null ? `Took ${took(m.durationMs)}` : '', m.steps != null ? `${m.steps} step${m.steps === 1 ? '' : 's'} applied` : ''].filter(Boolean).join(' · ')} +
+ {/if} + {#if m.logs} +{m.logs}
+ {/if}
+ {#if m.sql}
+ Pick the project folder to see this migration's SQL.
+ {/if} +