Commit 118700f3 authored by NGPixel's avatar NGPixel

fix: setup truncate + autoprefixer rollback

parent baae4e28
......@@ -193,7 +193,7 @@
"apollo-link-persisted-queries": "0.2.2",
"apollo-link-ws": "1.0.19",
"apollo-utilities": "1.3.2",
"autoprefixer": "9.7.0",
"autoprefixer": "9.6.4",
"babel-eslint": "10.0.3",
"babel-jest": "24.9.0",
"babel-loader": "^8.0.6",
......
......@@ -189,24 +189,35 @@ module.exports = () => {
])
// Truncate tables (reset from previous failed install)
if (WIKI.config.db.type !== 'mssql') {
await WIKI.models.locales.query().truncate()
await WIKI.models.groups.query().truncate()
await WIKI.models.users.query().truncate()
await WIKI.models.navigation.query().truncate()
} else {
await WIKI.models.locales.query().del()
await WIKI.models.groups.query().del()
await WIKI.models.users.query().del()
await WIKI.models.navigation.query().truncate()
await WIKI.models.knex.raw(`
IF EXISTS (SELECT * FROM sys.identity_columns WHERE OBJECT_NAME(OBJECT_ID) = 'groups' AND last_value IS NOT NULL)
DBCC CHECKIDENT ([groups], RESEED, 0)
`)
await WIKI.models.knex.raw(`
IF EXISTS (SELECT * FROM sys.identity_columns WHERE OBJECT_NAME(OBJECT_ID) = 'users' AND last_value IS NOT NULL)
DBCC CHECKIDENT ([users], RESEED, 0)
`)
await WIKI.models.locales.query().where('code', '!=', 'x').del()
await WIKI.models.navigation.query().truncate()
switch (WIKI.config.db.type) {
case 'postgres':
await WIKI.models.knex.raw('TRUNCATE groups, users CASCADE')
break
case 'mysql':
case 'mariadb':
await WIKI.models.groups.query().where('id', '>', 0).del()
await WIKI.models.users.query().where('id', '>', 0).del()
await WIKI.models.knex.raw('ALTER TABLE groups AUTO_INCREMENT = 1')
await WIKI.models.knex.raw('ALTER TABLE users AUTO_INCREMENT = 1')
break
case 'mssql':
await WIKI.models.groups.query().del()
await WIKI.models.users.query().del()
await WIKI.models.knex.raw(`
IF EXISTS (SELECT * FROM sys.identity_columns WHERE OBJECT_NAME(OBJECT_ID) = 'groups' AND last_value IS NOT NULL)
DBCC CHECKIDENT ([groups], RESEED, 0)
`)
await WIKI.models.knex.raw(`
IF EXISTS (SELECT * FROM sys.identity_columns WHERE OBJECT_NAME(OBJECT_ID) = 'users' AND last_value IS NOT NULL)
DBCC CHECKIDENT ([users], RESEED, 0)
`)
break
case 'sqlite':
await WIKI.models.groups.query().truncate()
await WIKI.models.users.query().truncate()
break
}
// Create default locale
......
This diff was suppressed by a .gitattributes entry.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment