Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
b567413f
Commit
b567413f
authored
Oct 25, 2019
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: handle failed setup retries
parent
820cc77a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
setup.js
server/setup.js
+25
-1
No files found.
server/setup.js
View file @
b567413f
...
...
@@ -188,6 +188,27 @@ module.exports = () => {
'title'
])
// 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)
`
)
}
// Create default locale
WIKI
.
logger
.
info
(
'Installing default locale...'
)
await
WIKI
.
models
.
locales
.
query
().
insert
({
...
...
@@ -277,7 +298,7 @@ module.exports = () => {
})
await
guestUser
.
$relatedQuery
(
'groups'
).
relate
(
guestGroup
.
id
)
if
(
adminUser
.
id
!==
1
||
guestUser
.
id
!==
2
)
{
throw
new
Error
(
'Incorrect
group
s auto-increment configuration! Should start at 0 and increment by 1. Contact your database administrator.'
)
throw
new
Error
(
'Incorrect
user
s auto-increment configuration! Should start at 0 and increment by 1. Contact your database administrator.'
)
}
// Create site nav
...
...
@@ -315,6 +336,9 @@ module.exports = () => {
},
1000
)
})
}
catch
(
err
)
{
try
{
await
WIKI
.
models
.
knex
(
'settings'
).
truncate
()
}
catch
(
err
)
{}
WIKI
.
telemetry
.
sendError
(
err
)
res
.
json
({
ok
:
false
,
error
:
err
.
message
})
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment