CREATE TABLE "RADKFILE_Version" (
  "version" VARCHAR(10) PRIMARY KEY NOT NULL,
  "date" DATE NOT NULL,
  "hash" VARCHAR(64) NOT NULL
) WITHOUT ROWID;

CREATE TRIGGER "RADKFILE_Version_SingleRow"
BEFORE INSERT ON "RADKFILE_Version"
WHEN (SELECT COUNT(*) FROM "RADKFILE_Version") >= 1
BEGIN
    SELECT RAISE(FAIL, 'Only one row allowed in RADKFILE_Version');
END;

CREATE TABLE "RADKFILE" (
  "kanji" CHAR(1) NOT NULL,
  "radical" CHAR(1) NOT NULL,
  PRIMARY KEY ("kanji", "radical")
) WITHOUT ROWID;

CREATE INDEX "RADK" ON "RADKFILE"("radical");
