Skip to content

Commit

Permalink
actually we can just exec the whole thing
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanflorence committed Dec 8, 2024
1 parent 1c3d12d commit 094e770
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/lib/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,10 @@ export class Migrator {
let id = migration.split("-")[0];
let db = this.db;

// Split into statements, filter out empty ones
let statements = sql
.split(";")
.map(stmt => stmt.trim())
.filter(stmt => stmt.length > 0);

if (!this.options.dry) {
db.transaction(() => {
for (let statement of statements) {
db.prepare(statement).run();
}
db.exec(sql);

// Track migration in _migralite table
if (direction === "up") {
db.prepare(
"INSERT INTO _migralite (id, name, applied_at) VALUES (?, ?, ?)",
Expand Down

0 comments on commit 094e770

Please sign in to comment.