diff --git a/database.js b/database.js index 108ff8ae..365b6e2e 100644 --- a/database.js +++ b/database.js @@ -168,7 +168,7 @@ function init() { "`contents` MEDIUMTEXT NOT NULL,", "`count` INT NOT NULL,", "`time` INT NOT NULL,", - "PRIMARY KEY (`name`))", + "PRIMARY KEY (`user`, `name`))", "ENGINE = MyISAM;"].join(""); results = db.querySync(query); if(!results) { diff --git a/update.js b/update.js index dc1602c5..980ec796 100644 --- a/update.js +++ b/update.js @@ -20,6 +20,15 @@ if(!db.querySync(query)) { populateChannelOwners(); } } + +console.log("Fixing user playlist bug"); +query = "ALTER TABLE user_playlists DROP PRIMARY KEY, ADD PRIMARY KEY (user, name)"; +if(!db.querySync(query)) { + console.log("Something went wrong"); +} +else { + console.log("fixed"); +} db.closeSync(); process.exit(0);