diff --git a/server/db/migrations/20190224045315-create-plex-library.js b/server/db/migrations/20190224045315-create-plex-library.js index 4c2d64a..1c1540c 100644 --- a/server/db/migrations/20190224045315-create-plex-library.js +++ b/server/db/migrations/20190224045315-create-plex-library.js @@ -1,6 +1,6 @@ module.exports = { - up: (queryInterface, Sequelize) => { - return queryInterface.createTable('PlexLibraries', { + up: async (queryInterface, Sequelize) => { + await queryInterface.createTable('PlexLibraries', { id: { allowNull: false, autoIncrement: true, @@ -50,6 +50,7 @@ module.exports = { type: Sequelize.DATE, }, }); + return queryInterface.addIndex('PlexLibraries', ['UserId', 'title']); }, // eslint-disable-next-line no-unused-vars down: (queryInterface, Sequelize) => { diff --git a/server/db/migrations/20190224045418-create-plex-section.js b/server/db/migrations/20190224045418-create-plex-section.js index 733a682..6bed87a 100644 --- a/server/db/migrations/20190224045418-create-plex-section.js +++ b/server/db/migrations/20190224045418-create-plex-section.js @@ -1,6 +1,6 @@ module.exports = { - up: (queryInterface, Sequelize) => { - return queryInterface.createTable('PlexSections', { + up: async (queryInterface, Sequelize) => { + await queryInterface.createTable('PlexSections', { id: { allowNull: false, autoIncrement: true, @@ -32,6 +32,7 @@ module.exports = { }, }, }); + return queryInterface.addIndex('PlexSections', ['UserId', 'title']); }, // eslint-disable-next-line no-unused-vars down: (queryInterface, Sequelize) => { diff --git a/server/index.js b/server/index.js index 6289b56..8becf7e 100644 --- a/server/index.js +++ b/server/index.js @@ -75,7 +75,7 @@ export default () => { const port = server.get('port'); - sequelize.sync().then(() => { + sequelize.sync({force: true}).then(() => { server.listen(port, () => { console.log(`Express server listening on - http://${hostname}:${port}`); }); diff --git a/server/services/auth/passport.js b/server/services/auth/passport.js index d2bd6d9..fc5b066 100644 --- a/server/services/auth/passport.js +++ b/server/services/auth/passport.js @@ -25,7 +25,7 @@ passport.use( async (accessToken, refreshToken, profile, done) => { console.log(profile); const existingUser = await models.User.findOne({ - where: {googleId: '103913097386807680151'}, + where: {googleId: profile.id}, }); if (existingUser) {