mirror of
https://forge.liiib.re/indiehost/libre.sh/libre.sh.git
synced 2024-12-28 06:36:42 +00:00
fix(postgres): skip migration when db doesn't exist
All checks were successful
/ publish (push) Successful in 10s
All checks were successful
/ publish (push) Successful in 10s
This commit is contained in:
parent
44e05b66fe
commit
5373274a0e
1 changed files with 7 additions and 1 deletions
|
@ -355,7 +355,13 @@ func bucketLifecycleRule() lshcore.LifecycleRule {
|
||||||
func (r *PostgresReconciler) migrateCollation(ctx context.Context, patcher *patch.SerialPatcher, postgres *lshcore.Postgres, pg *pgv1.Postgresql, db *sql.DB) error {
|
func (r *PostgresReconciler) migrateCollation(ctx context.Context, patcher *patch.SerialPatcher, postgres *lshcore.Postgres, pg *pgv1.Postgresql, db *sql.DB) error {
|
||||||
_, err := db.ExecContext(ctx,
|
_, err := db.ExecContext(ctx,
|
||||||
fmt.Sprintf("ALTER DATABASE %s REFRESH COLLATION VERSION;", postgres.Spec.Database))
|
fmt.Sprintf("ALTER DATABASE %s REFRESH COLLATION VERSION;", postgres.Spec.Database))
|
||||||
if err, ok := err.(*pq.Error); ok && err.Message == "invalid collation version change" {
|
if err, ok := err.(*pq.Error); ok {
|
||||||
|
if err.Code == "3D000" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if err.Message != "invalid collation version change" {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if conditions.IsTrue(postgres, lshmeta.OperationInProgress) {
|
if conditions.IsTrue(postgres, lshmeta.OperationInProgress) {
|
||||||
return errors.New("operation already in progress")
|
return errors.New("operation already in progress")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue