TABLE admin
  key         textColumnType()
  version     INTEGER

TABLE devices
  id          idType()
  type        textColumnType()
  label       textColumnType()
  lastmountpoint  textColumnType()
  uuid        textColumnType()
  servername  textColumnType()
  sharename   textColumnType()
INDEX ON type, uuid, (servername, sharename)

TABLE urls
  id          idType()
  deviceid    INTEGER       -> devices::id
  rpath       exactTextColumnType()
UNIQUE (deviceid, rpath)

TABLE artists
  id          idType()
  name        textColumnType() NOT NULL
UNIQUE name

TABLE albums
  id          idType()
  name        textColumnType() NOT NULL
  artist      INTEGER       -> artists::id
UNIQUE (name, artist)
INDEX ON name, artist

TABLE genres
  id          idType()
  name        textColumnType() NOT NULL
UNIQUE name

TABLE composers
  id          idType()
  name        textColumnType() NOT NULL
UNIQUE name

TABLE years
  id          idType()
  name        textColumnType() NOT NULL
UNIQUE name

TABLE tracks
  id          idType()
  url         INTEGER       -> urls::id
  artist      INTEGER       -> artists::id
  album       INTEGER       -> albums::id
  genre       INTEGER       -> genres::id
  composer    INTEGER       -> composers::id
  year        INTEGER       -> years::id
  title       textColumnType()
  comment     textColumnType()
  track       INTEGER
  discnumber  INTEGER
  bitrate     INTEGER
  length      INTEGER
  samplerate  INTEGER
  filesize    INTEGER
  filetype    INTEGER
  bpm         FLOAT
  createdate  INTEGER
  modifydate  INTEGER
UNIQUE url

TABLE statistics
  id          idType()
  url         INTEGER       -> urls::id
  createdate  INTEGER
  accessdate  INTEGER
  score       FLOAT
  rating      INTEGER DEFAULT 0
  playcount   INTEGER
INDEX ON url

TABLE labels
  id          INTEGER
  label       textColumnType()
UNIQUE label

TABLE urls_labels
  url         INTEGER       -> urls::id
  label       INTEGER       -> labels::id
INDEX ON url, label
