只调整收件人或时间也会递增设置版本,导致已保存的授权码无法解密、测试发送报存储不可用。 新增 password_revision 记录加密时的版本,迁移回填现有行。
This commit is contained in:
@@ -0,0 +1 @@
|
||||
alter table qa_weekly_email_settings drop column if exists password_revision;
|
||||
@@ -0,0 +1,3 @@
|
||||
-- 授权码按"写入它时的版本"解密:只改其它设置不再使已保存的密码失效。
|
||||
alter table qa_weekly_email_settings add column if not exists password_revision bigint not null default 0;
|
||||
update qa_weekly_email_settings set password_revision = revision where password_revision = 0 and smtp_password_sealed is not null;
|
||||
@@ -11,8 +11,8 @@ func TestEmbeddedMigrationsAreVersionSorted(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("loadMigrations() error = %v", err)
|
||||
}
|
||||
if len(migrations) != 63 {
|
||||
t.Fatalf("migration count = %d, want 63", len(migrations))
|
||||
if len(migrations) != 64 {
|
||||
t.Fatalf("migration count = %d, want 64", len(migrations))
|
||||
}
|
||||
if migrations[0].Version != 1 || !strings.Contains(migrations[0].UpSQL, "CREATE TABLE IF NOT EXISTS jobs") {
|
||||
t.Fatalf("migration 1 = %#v", migrations[0])
|
||||
|
||||
Reference in New Issue
Block a user