feat: add software_hashes table schema and reimport pipeline

- Add softwareHashes Drizzle model (download_id PK, md5, crc32,
  size_bytes, inner_path, updated_at)
- Update import_mysql.sh to reimport from JSON snapshot after DB wipe
- Add pnpm scripts: update:hashes, export:hashes
- Create data/zxdb/ directory for JSON snapshot storage

claude-opus-4-6@MacFiver
This commit is contained in:
2026-02-17 16:06:51 +00:00
parent 944a2dc4d1
commit f5ae89e888
4 changed files with 61 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
import { mysqlTable, int, varchar, tinyint, char, smallint, decimal, text, mediumtext, longtext } from "drizzle-orm/mysql-core";
import { mysqlTable, int, varchar, tinyint, char, smallint, decimal, text, mediumtext, longtext, bigint, timestamp } from "drizzle-orm/mysql-core";
// Minimal subset needed for browsing/searching
export const entries = mysqlTable("entries", {
@@ -646,3 +646,16 @@ export const zxsrScores = mysqlTable("zxsr_scores", {
score: varchar("score", { length: 100 }),
comments: text("comments"),
});
// ---- Derived tables (managed by update scripts, not part of ZXDB upstream) ----
// Stores MD5, CRC32 and size of the inner tape file extracted from download zips.
// Populated by bin/update-software-hashes.mjs; survives DB wipes via JSON snapshot.
export const softwareHashes = mysqlTable("software_hashes", {
downloadId: int("download_id").notNull().primaryKey(),
md5: varchar("md5", { length: 32 }).notNull(),
crc32: varchar("crc32", { length: 8 }).notNull(),
sizeBytes: bigint("size_bytes", { mode: "number" }).notNull(),
innerPath: varchar("inner_path", { length: 500 }).notNull(),
updatedAt: timestamp("updated_at").notNull().defaultNow(),
});