mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-09 19:48:45 +01:00
fix remoteidx insert code
This commit is contained in:
parent
f75b75790c
commit
eab785409a
@ -121,12 +121,12 @@ func UpsertRemote(ctx context.Context, r *RemoteType) error {
|
|||||||
if tx.Exists(query, r.RemoteCanonicalName) {
|
if tx.Exists(query, r.RemoteCanonicalName) {
|
||||||
return fmt.Errorf("remote has duplicate canonicalname '%s', cannot create", r.RemoteCanonicalName)
|
return fmt.Errorf("remote has duplicate canonicalname '%s', cannot create", r.RemoteCanonicalName)
|
||||||
}
|
}
|
||||||
query = `SELECT max(remoteidx) FROM remote`
|
query = `SELECT COALESCE(max(remoteidx), 0) FROM remote`
|
||||||
maxRemoteIdx := tx.GetInt(query)
|
maxRemoteIdx := tx.GetInt(query)
|
||||||
r.RemoteIdx = int64(maxRemoteIdx + 1)
|
r.RemoteIdx = int64(maxRemoteIdx + 1)
|
||||||
query = `INSERT INTO remote
|
query = `INSERT INTO remote
|
||||||
( remoteid, physicalid, remotetype, remotealias, remotecanonicalname, remotesudo, remoteuser, remotehost, connectmode, initpk, sshopts, remoteopts, lastconnectts, archived) VALUES
|
( remoteid, physicalid, remotetype, remotealias, remotecanonicalname, remotesudo, remoteuser, remotehost, connectmode, initpk, sshopts, remoteopts, lastconnectts, archived, remoteidx) VALUES
|
||||||
(:remoteid,:physicalid,:remotetype,:remotealias,:remotecanonicalname,:remotesudo,:remoteuser,:remotehost,:connectmode,:initpk,:sshopts,:remoteopts,:lastconnectts,:archived)`
|
(:remoteid,:physicalid,:remotetype,:remotealias,:remotecanonicalname,:remotesudo,:remoteuser,:remotehost,:connectmode,:initpk,:sshopts,:remoteopts,:lastconnectts,:archived,:remoteidx)`
|
||||||
tx.NamedExecWrap(query, r.ToMap())
|
tx.NamedExecWrap(query, r.ToMap())
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user