PHP 7.4.33
Preview: migrator.js Size: 1.15 KB
/var/www/gtechmarathon2026.bitkit.dk/httpdocs/node_modules/drizzle-orm/sqlite-proxy/migrator.js
import { readMigrationFiles } from "../migrator.js";
import { sql } from "../sql/sql.js";
async function migrate(db, callback, config) {
  const migrations = readMigrationFiles(config);
  const migrationsTable = typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
  const migrationTableCreate = sql`
		CREATE TABLE IF NOT EXISTS ${sql.identifier(migrationsTable)} (
			id SERIAL PRIMARY KEY,
			hash text NOT NULL,
			created_at numeric
		)
	`;
  await db.run(migrationTableCreate);
  const dbMigrations = await db.values(
    sql`SELECT id, hash, created_at FROM ${sql.identifier(migrationsTable)} ORDER BY created_at DESC LIMIT 1`
  );
  const lastDbMigration = dbMigrations[0] ?? void 0;
  const queriesToRun = [];
  for (const migration of migrations) {
    if (!lastDbMigration || Number(lastDbMigration[2]) < migration.folderMillis) {
      queriesToRun.push(
        ...migration.sql,
        `INSERT INTO \`${migrationsTable}\` ("hash", "created_at") VALUES('${migration.hash}', '${migration.folderMillis}')`
      );
    }
  }
  await callback(queriesToRun);
}
export {
  migrate
};
//# sourceMappingURL=migrator.js.map

Directory Contents

Dirs: 0 × Files: 24
Name Size Perms Modified Actions
2.68 KB lrw-r--r-- 2025-07-10 12:54:57
Edit Download
4.43 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.36 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.36 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
1.59 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
4.42 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.21 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
226 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
61 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
59 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
92 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
187 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
2.21 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
2.26 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
363 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
361 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
1.15 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
2.23 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
6.72 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
12.17 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
3.78 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
3.77 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
5.37 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
12.15 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).