mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-05 22:17:20 +02:00
fix initprovider exit code for MySQL and PostgreSQL
This commit is contained in:
@@ -172,6 +172,10 @@ func (p MySQLProvider) reloadConfig() error {
|
|||||||
|
|
||||||
// initializeDatabase creates the initial database structure
|
// initializeDatabase creates the initial database structure
|
||||||
func (p MySQLProvider) initializeDatabase() error {
|
func (p MySQLProvider) initializeDatabase() error {
|
||||||
|
dbVersion, err := sqlCommonGetDatabaseVersion(p.dbHandle, false)
|
||||||
|
if err == nil && dbVersion.Version > 0 {
|
||||||
|
return ErrNoInitRequired
|
||||||
|
}
|
||||||
sqlUsers := strings.Replace(mysqlUsersTableSQL, "{{users}}", sqlTableUsers, 1)
|
sqlUsers := strings.Replace(mysqlUsersTableSQL, "{{users}}", sqlTableUsers, 1)
|
||||||
tx, err := p.dbHandle.Begin()
|
tx, err := p.dbHandle.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -171,6 +171,10 @@ func (p PGSQLProvider) reloadConfig() error {
|
|||||||
|
|
||||||
// initializeDatabase creates the initial database structure
|
// initializeDatabase creates the initial database structure
|
||||||
func (p PGSQLProvider) initializeDatabase() error {
|
func (p PGSQLProvider) initializeDatabase() error {
|
||||||
|
dbVersion, err := sqlCommonGetDatabaseVersion(p.dbHandle, false)
|
||||||
|
if err == nil && dbVersion.Version > 0 {
|
||||||
|
return ErrNoInitRequired
|
||||||
|
}
|
||||||
sqlUsers := strings.Replace(pgsqlUsersTableSQL, "{{users}}", sqlTableUsers, 1)
|
sqlUsers := strings.Replace(pgsqlUsersTableSQL, "{{users}}", sqlTableUsers, 1)
|
||||||
tx, err := p.dbHandle.Begin()
|
tx, err := p.dbHandle.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user