AnkiSchema
in package
Anki collection.anki21 schema (legacy schema 11).
Anki downgrades to schema 11 for export so every client can read the
resulting .apkg. Tables, columns, indexes, and the JSON shapes for the
col row come from the upstream Rust source (rslib/src/storage/schema11.sql,
rslib/src/notetype/schema11.rs) cross-checked against a real .apkg dump.
Table of Contents
Constants
- FIELD_LWT_ID : mixed = 'LwtId'
- FIELD_NOTES : mixed = 'Notes'
- FIELD_ROMANIZATION : mixed = 'Romanization'
- FIELD_SEPARATOR : mixed = "\x1f"
- FIELD_TERM : mixed = 'Term'
- FIELD_TRANSLATION : mixed = 'Translation'
- NOTETYPE_ID : mixed = 1607392319000
- NOTETYPE_NAME : mixed = 'LWT Term'
- SCHEMA_VERSION : mixed = 11
- TEMPLATE_NAME : mixed = 'Term -> Translation'
Methods
- assertSqliteAvailable() : void
- An .apkg is a zipped SQLite collection, so the whole feature needs pdo_sqlite. It ships enabled on most Linux builds but not on stock Windows PHP, where the driver only surfaces as a bare "could not find driver" PDOException from deep inside the writer.
- buildDeck() : array<string, mixed>
- Build an LWT deck row keyed for `col.decks`.
- buildNotetype() : array<string, mixed>
- The single LWT note type. Five fields; one card template.
- createStatements() : array<int, string>
- Sequence of CREATE statements to build a fresh collection.anki21.
- defaultConf() : array<string, mixed>
- Default `col.conf` JSON used by every fresh collection.
- defaultDeck() : array<string, mixed>
- Default deck row (`col.decks` includes id 1 plus any LWT deck added).
- defaultDeckConfig() : array<string|int, mixed>
- Default deck configuration (`col.dconf`) — id 1, the deck preset every other deck inherits from.
- fieldChecksum() : int
- Anki's field checksum: integer value of the first 8 hex chars of the SHA-1 of the stripped first field. Used for duplicate detection.
Constants
FIELD_LWT_ID
public
mixed
FIELD_LWT_ID
= 'LwtId'
FIELD_NOTES
public
mixed
FIELD_NOTES
= 'Notes'
FIELD_ROMANIZATION
public
mixed
FIELD_ROMANIZATION
= 'Romanization'
FIELD_SEPARATOR
public
mixed
FIELD_SEPARATOR
= "\x1f"
FIELD_TERM
public
mixed
FIELD_TERM
= 'Term'
FIELD_TRANSLATION
public
mixed
FIELD_TRANSLATION
= 'Translation'
NOTETYPE_ID
public
mixed
NOTETYPE_ID
= 1607392319000
NOTETYPE_NAME
public
mixed
NOTETYPE_NAME
= 'LWT Term'
SCHEMA_VERSION
public
mixed
SCHEMA_VERSION
= 11
TEMPLATE_NAME
public
mixed
TEMPLATE_NAME
= 'Term -> Translation'
Methods
assertSqliteAvailable()
An .apkg is a zipped SQLite collection, so the whole feature needs pdo_sqlite. It ships enabled on most Linux builds but not on stock Windows PHP, where the driver only surfaces as a bare "could not find driver" PDOException from deep inside the writer.
public
static assertSqliteAvailable() : void
Fail early with something a user can act on instead.
buildDeck()
Build an LWT deck row keyed for `col.decks`.
public
static buildDeck(int $deckId, string $name) : array<string, mixed>
Parameters
- $deckId : int
- $name : string
Return values
array<string, mixed>buildNotetype()
The single LWT note type. Five fields; one card template.
public
static buildNotetype(int $defaultDeckId, int $modSeconds) : array<string, mixed>
Parameters
- $defaultDeckId : int
- $modSeconds : int
Return values
array<string, mixed>createStatements()
Sequence of CREATE statements to build a fresh collection.anki21.
public
static createStatements() : array<int, string>
Return values
array<int, string>defaultConf()
Default `col.conf` JSON used by every fresh collection.
public
static defaultConf() : array<string, mixed>
Return values
array<string, mixed>defaultDeck()
Default deck row (`col.decks` includes id 1 plus any LWT deck added).
public
static defaultDeck() : array<string, mixed>
Return values
array<string, mixed>defaultDeckConfig()
Default deck configuration (`col.dconf`) — id 1, the deck preset every other deck inherits from.
public
static defaultDeckConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>fieldChecksum()
Anki's field checksum: integer value of the first 8 hex chars of the SHA-1 of the stripped first field. Used for duplicate detection.
public
static fieldChecksum(string $sortField) : int
Parameters
- $sortField : string