FireFly Media Server (formerly mt-daapd) › Firefly Media Server Forums › Firefly Media Server › General Discussion › ‘idx’ and ‘disable’ fields in database › Reply To: ‘idx’ and ‘disable’ fields in database
Each (proper) database needs an primary key, for firefly’s song-db this is the field called “idx”.
You are absolutely correct, except that the PK is the ‘id’ column:
CREATE TABLE songs (
id INTEGER PRIMARY KEY NOT NULL,
path VARCHAR(4096) NOT NULL,
fname VARCHAR(255) NOT NULL,
codectype VARCHAR(5) DEFAULT NULL,
idx INTEGER NOT NULL,
has_video INTEGER DEFAULT 0,
CREATE INDEX idx_path on songs(path,idx)
In practice, firefly’s file scanner always (?) populates idx with 0.
It appears that idx is there to enable a file to be inserted into the database more than once – but why?