/data/sql/dbmigrate-23_to_24.sql

http://github.com/tomahawk-player/tomahawk · SQL · 22 lines · 12 code · 6 blank · 4 comment · 1 complexity · 2e4e1375cbfd729d12bfad8c2a6d8e8f MD5 · raw file

  1. -- Script to migate from db version 23 to 24.
  2. -- Added the social_attributes table.
  3. --
  4. -- Separate each command with %%
  5. CREATE TABLE IF NOT EXISTS social_attributes (
  6. id INTEGER REFERENCES track(id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED, -- track id
  7. source INTEGER REFERENCES source(id) ON DELETE CASCADE ON UPDATE CASCADE, -- DEFERRABLE INITIALLY DEFERRED,
  8. k TEXT NOT NULL,
  9. v TEXT NOT NULL,
  10. timestamp INTEGER NOT NULL DEFAULT 0
  11. );
  12. CREATE INDEX social_attrib_id ON social_attributes(id);
  13. CREATE INDEX social_attrib_source ON social_attributes(source);
  14. CREATE INDEX social_attrib_k ON social_attributes(k);
  15. CREATE INDEX social_attrib_timestamp ON social_attributes(timestamp);
  16. UPDATE settings SET v = '24' WHERE k == 'schema_version';