There are three SQLite3 tables (Location
, Music
and History
) that need to be vacuumed.
For the first two tables, the Primary Key cannot change, and for the last table (History
), the Primary key should change.
The SQLite VACUUM command states something about "unaliased", which is confusing.
Can someone state the syntax to be used?
TL;DR
Location Table (leave Primary key intact)
con.execute(
"CREATE TABLE IF NOT EXISTS Location(Id INTEGER PRIMARY KEY, " +
"Code TEXT, Name TEXT, ModifyTime FLOAT, ImagePath TEXT, " +
"MountPoint TEXT, TopDir TEXT, HostName TEXT, " +
"HostWakeupCmd TEXT, HostTestCmd TEXT, HostTestRepeat INT, " +
"HostMountCmd TEXT, HostTouchCmd TEXT, HostTouchMinutes INT, " +
"Comments TEXT)")
con.execute("CREATE UNIQUE INDEX IF NOT EXISTS LocationCodeIndex ON " +
"Location(Code)")
Music Table (leave Primary key intact)
con.execute(
"create table IF NOT EXISTS Music(Id INTEGER PRIMARY KEY, " +
"OsFileName TEXT, OsAccessTime FLOAT, OsModifyTime FLOAT, " +
"OsChangeTime FLOAT, OsFileSize INT, " +
"ffMajor TEXT, ffMinor TEXT, ffCompatible TEXT, " +
"Title TEXT, Artist TEXT, Album TEXT, Compilation TEXT, " +
"AlbumArtist TEXT, AlbumDate TEXT, FirstDate TEXT, " +
"CreationTime TEXT, DiscNumber TEXT, TrackNumber TEXT, " +
"Rating TEXT, Genre TEXT, Composer TEXT, Comment TEXT, " +
"Hyperlink TEXT, Duration TEXT, Seconds FLOAT, " +
"GaplessPlayback TEXT, PlayCount INT, LastPlayTime FLOAT, " +
"LyricsScore BLOB, LyricsTimeIndex TEXT)")
con.execute("CREATE UNIQUE INDEX IF NOT EXISTS OsFileNameIndex ON " +
"Music(OsFileName)")
History Table (primary key needs to be reset)
con.execute(
"create table IF NOT EXISTS History(Id INTEGER PRIMARY KEY, " +
"Time FLOAT, MusicId INTEGER, User TEXT, Type TEXT, " +
"Action TEXT, SourceMaster TEXT, SourceDetail TEXT, " +
"Target TEXT, Size INT, Count INT, Seconds FLOAT, " +
"Comments TEXT, Timestamp FLOAT)")
con.execute("CREATE INDEX IF NOT EXISTS MusicIdIndex ON " +
"History(MusicId)")
con.execute("CREATE UNIQUE INDEX IF NOT EXISTS TimeIndex ON " +
"History(Timestamp)")
con.execute("CREATE INDEX IF NOT EXISTS TypeActionIndex ON " +
"History(Type, Action)")