Attempting to resolved 'no such column: profile_pictures_show_to'
Have resolved the settings table not found but now the column is not migrating for some reason
This commit is contained in:
parent
a50048e290
commit
0ff7a864ec
|
@ -380,7 +380,7 @@ func (db *Database) SaveSetting(setting string, value interface{}) error {
|
|||
update, err = db.db.Prepare("UPDATE settings SET wallet_visible_tokens = ? WHERE synthetic_id = 'id'")
|
||||
case "appearance":
|
||||
update, err = db.db.Prepare("UPDATE settings SET appearance = ? WHERE synthetic_id = 'id'")
|
||||
case "profile_pictures_show_to":
|
||||
case "profile-pictures-show-to":
|
||||
update, err = db.db.Prepare("UPDATE settings SET profile_pictures_show_to = ? WHERE synthetic_id = 'id'")
|
||||
case "profile-pictures-visibility":
|
||||
update, err = db.db.Prepare("UPDATE settings SET profile_pictures_visibility = ? WHERE synthetic_id = 'id'")
|
||||
|
|
|
@ -201,6 +201,14 @@ func NewMessenger(
|
|||
}
|
||||
}
|
||||
|
||||
// Apply any post database creation changes to the database
|
||||
c.db = database
|
||||
for _, opt := range c.afterDbCreatedHooks {
|
||||
if err := opt(&c); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// Apply migrations for all components.
|
||||
err := sqlite.Migrate(database)
|
||||
if err != nil {
|
||||
|
@ -776,6 +784,12 @@ func (m *Messenger) attachIdentityImagesToChatIdentity(context chatContext, ci *
|
|||
return err
|
||||
}
|
||||
|
||||
if s.ProfilePicturesVisibility == accounts.ProfilePicturesVisibilityContactsOnly {
|
||||
m.logger.Info("settings.ProfilePicturesVisibility is there")
|
||||
}
|
||||
|
||||
// TODO check that all the migration code is in place use ProfilePicturesVisibility as a guide
|
||||
// getting an error of no such column: profile_pictures_show_to
|
||||
if s.ProfilePicturesShowTo == accounts.ProfilePicturesShowToNone {
|
||||
m.logger.Info(fmt.Sprintf("settings.ProfilePicturesShowTo is set to '%d', skipping attaching IdentityImages", s.ProfilePicturesShowTo))
|
||||
return nil
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/status-im/status-go/appdatabase/migrations"
|
||||
"github.com/status-im/status-go/multiaccounts"
|
||||
"github.com/status-im/status-go/protocol/anonmetrics"
|
||||
"github.com/status-im/status-go/protocol/common"
|
||||
|
@ -44,6 +45,7 @@ type config struct {
|
|||
// The database instance has a higher priority.
|
||||
dbConfig dbConfig
|
||||
db *sql.DB
|
||||
afterDbCreatedHooks []Option
|
||||
multiAccount *multiaccounts.Database
|
||||
mailserversDatabase *mailservers.Database
|
||||
account *multiaccounts.Account
|
||||
|
@ -102,6 +104,15 @@ func WithDatabase(db *sql.DB) Option {
|
|||
}
|
||||
}
|
||||
|
||||
func WithToplevelDatabaseMigrations() Option {
|
||||
return func(c *config) error {
|
||||
c.afterDbCreatedHooks = append(c.afterDbCreatedHooks, func(c *config) error {
|
||||
return migrations.Migrate(c.db)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func WithMultiAccounts(ma *multiaccounts.Database) Option {
|
||||
return func(c *config) error {
|
||||
c.multiAccount = ma
|
||||
|
|
|
@ -132,6 +132,7 @@ func newMessengerWithKey(shh types.Waku, privateKey *ecdsa.PrivateKey, logger *z
|
|||
WithMultiAccounts(madb),
|
||||
WithAccount(iai.ToMultiAccount()),
|
||||
WithDatasync(),
|
||||
WithToplevelDatabaseMigrations(),
|
||||
}
|
||||
|
||||
options = append(options, extraOptions...)
|
||||
|
|
Loading…
Reference in New Issue