fix: remove explicit ids for groups and users during setup (#1156)

This commit is contained in:
NGPixel 2019-11-02 16:30:19 -04:00
parent d69dde1df5
commit b4cb8249f5

View File

@ -234,14 +234,12 @@ module.exports = () => {
WIKI.logger.info('Creating default groups...') WIKI.logger.info('Creating default groups...')
const adminGroup = await WIKI.models.groups.query().insert({ const adminGroup = await WIKI.models.groups.query().insert({
...(WIKI.config.db.type !== `mssql` && { id: 1 }),
name: 'Administrators', name: 'Administrators',
permissions: JSON.stringify(['manage:system']), permissions: JSON.stringify(['manage:system']),
pageRules: JSON.stringify([]), pageRules: JSON.stringify([]),
isSystem: true isSystem: true
}) })
const guestGroup = await WIKI.models.groups.query().insert({ const guestGroup = await WIKI.models.groups.query().insert({
...(WIKI.config.db.type !== `mssql` && { id: 2 }),
name: 'Guests', name: 'Guests',
permissions: JSON.stringify(['read:pages', 'read:assets', 'read:comments']), permissions: JSON.stringify(['read:pages', 'read:assets', 'read:comments']),
pageRules: JSON.stringify([ pageRules: JSON.stringify([
@ -279,7 +277,6 @@ module.exports = () => {
// Create root administrator // Create root administrator
WIKI.logger.info('Creating root administrator...') WIKI.logger.info('Creating root administrator...')
const adminUser = await WIKI.models.users.query().insert({ const adminUser = await WIKI.models.users.query().insert({
...(WIKI.config.db.type !== `mssql` && { id: 1 }),
email: req.body.adminEmail, email: req.body.adminEmail,
provider: 'local', provider: 'local',
password: req.body.adminPassword, password: req.body.adminPassword,
@ -295,7 +292,6 @@ module.exports = () => {
// Create Guest account // Create Guest account
WIKI.logger.info('Creating guest account...') WIKI.logger.info('Creating guest account...')
const guestUser = await WIKI.models.users.query().insert({ const guestUser = await WIKI.models.users.query().insert({
...(WIKI.config.db.type !== `mssql` && { id: 2 }),
provider: 'local', provider: 'local',
email: 'guest@example.com', email: 'guest@example.com',
name: 'Guest', name: 'Guest',