mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-29 17:46:15 -06:00
Merge remote-tracking branch 'upstream/main' into feature/add-sqlite-support
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
This commit is contained in:
commit
63412d565b
2 changed files with 19 additions and 11 deletions
|
|
@ -79,8 +79,13 @@ volumes:
|
|||
host:
|
||||
path: /drone/gotosocial/golangci-lint
|
||||
|
||||
trigger:
|
||||
repo:
|
||||
- superseriousbusiness/gotosocial
|
||||
- NyaaaWhatsUpDoc/gotosocial
|
||||
|
||||
---
|
||||
kind: signature
|
||||
hmac: 9134975e238ab9f92a7f75ccc11279e8d5edddb87f10165ed3c7d23fdd9c8a11
|
||||
hmac: 7fa6fa70be0a5c436ecb2f02f4b74bd1be5e90817e2d95a16898e3d29cbadf80
|
||||
|
||||
...
|
||||
|
|
|
|||
|
|
@ -234,17 +234,18 @@ func (a *adminDB) CreateInstanceInstance(ctx context.Context) db.Error {
|
|||
domain := a.config.Host
|
||||
|
||||
// check if instance entry already exists
|
||||
existsQ := a.conn.
|
||||
q := a.conn.
|
||||
NewSelect().
|
||||
Model(>smodel.Instance{}).
|
||||
Where("domain = ?", domain)
|
||||
|
||||
count, err := existsQ.Count(ctx)
|
||||
if err != nil && count == 1 {
|
||||
a.log.Infof("instance instance %s already exists", domain)
|
||||
exists, err := a.conn.Exists(ctx, q)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if exists {
|
||||
a.log.Infof("instance entry already exists")
|
||||
return nil
|
||||
} else if err != sql.ErrNoRows {
|
||||
return a.conn.ProcessError(err)
|
||||
}
|
||||
|
||||
iID, err := id.NewRandomULID()
|
||||
|
|
@ -263,9 +264,11 @@ func (a *adminDB) CreateInstanceInstance(ctx context.Context) db.Error {
|
|||
NewInsert().
|
||||
Model(i)
|
||||
|
||||
if _, err := insertQ.Exec(ctx); err != nil {
|
||||
return err
|
||||
_, err = insertQ.Exec(ctx)
|
||||
err = a.conn.ProcessError(err)
|
||||
|
||||
if err == nil {
|
||||
a.log.Infof("created instance instance %s with id %s", domain, i.ID)
|
||||
}
|
||||
a.log.Infof("created instance instance %s with id %s", domain, i.ID)
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue