mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-29 22:36:14 -06:00
Remove redundant index on unique column
Also removes redundant unique and notnull tags on ID column since these are implied by pk
This commit is contained in:
parent
8542e8a7a3
commit
c1cc2a5217
2 changed files with 10 additions and 15 deletions
|
|
@ -35,19 +35,14 @@ func init() {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for index, columns := range map[string][]string{
|
if _, err := tx.
|
||||||
"web_push_subscriptions_account_id_idx": {"account_id"},
|
NewCreateIndex().
|
||||||
"web_push_subscriptions_token_id_idx": {"token_id"},
|
Model(>smodel.WebPushSubscription{}).
|
||||||
} {
|
Index("web_push_subscriptions_account_id_idx").
|
||||||
if _, err := tx.
|
Column("account_id").
|
||||||
NewCreateIndex().
|
IfNotExists().
|
||||||
Model(>smodel.WebPushSubscription{}).
|
Exec(ctx); err != nil {
|
||||||
Index(index).
|
return err
|
||||||
Column(columns...).
|
|
||||||
IfNotExists().
|
|
||||||
Exec(ctx); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@ package gtsmodel
|
||||||
// There can be at most one per access token.
|
// There can be at most one per access token.
|
||||||
type WebPushSubscription struct {
|
type WebPushSubscription struct {
|
||||||
// ID of this subscription in the database.
|
// ID of this subscription in the database.
|
||||||
ID string `bun:"type:CHAR(26),pk,nullzero,notnull,unique"`
|
ID string `bun:"type:CHAR(26),pk,nullzero"`
|
||||||
|
|
||||||
// AccountID of the local account that created this subscription.
|
// AccountID of the local account that created this subscription.
|
||||||
AccountID string `bun:"type:CHAR(26),notnull,nullzero"`
|
AccountID string `bun:"type:CHAR(26),nullzero,notnull"`
|
||||||
|
|
||||||
// TokenID is the ID of the associated access token.
|
// TokenID is the ID of the associated access token.
|
||||||
// There can be at most one subscription for any given access token,
|
// There can be at most one subscription for any given access token,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue