Add various deleted flags to entities | Add active to subscriptions | Add DeleteUser && DeleteChannel endpoints
Some checks failed
Build Docker and Deploy / Deploy to Server (push) Blocked by required conditions
Build Docker and Deploy / Build Docker Container (push) Successful in 53s
Build Docker and Deploy / Run Unit-Tests (push) Has been cancelled

This commit is contained in:
2025-04-13 16:12:15 +02:00
parent aac34ef738
commit 67882713f9
47 changed files with 2453 additions and 243 deletions

View File

@@ -182,7 +182,7 @@ func (db *Database) migrateSingle(tctx *simplectx.SimpleContext, tx sq.Tx, schem
if schemaFrom == schemaTo-1 {
migSQL := db.schema[schemaTo].MigScript
if migSQL == "" {
if len(migSQL) == 0 {
return exerr.New(exerr.TypeInternal, fmt.Sprintf("missing %s migration from %d to %d", db.name, schemaFrom, schemaTo)).Build()
}
@@ -192,7 +192,7 @@ func (db *Database) migrateSingle(tctx *simplectx.SimpleContext, tx sq.Tx, schem
return exerr.New(exerr.TypeInternal, fmt.Sprintf("missing %s migration from %d to %d", db.name, schemaFrom, schemaTo)).Build()
}
func (db *Database) migrateBySQL(tctx *simplectx.SimpleContext, tx sq.Tx, stmts string, currSchemaVers int, resultSchemVers int, resultHash string, post func(tctx *simplectx.SimpleContext, tx sq.Tx) error) error {
func (db *Database) migrateBySQL(tctx *simplectx.SimpleContext, tx sq.Tx, stmts []string, currSchemaVers int, resultSchemVers int, resultHash string, post func(tctx *simplectx.SimpleContext, tx sq.Tx) error) error {
schemaHashMeta, err := db.ReadMetaString(tctx, "schema_hash")
if err != nil {
@@ -215,9 +215,13 @@ func (db *Database) migrateBySQL(tctx *simplectx.SimpleContext, tx sq.Tx, stmts
log.Info().Msgf("Upgrade schema from %d -> %d", currSchemaVers, resultSchemVers)
_, err = tx.Exec(tctx, stmts, sq.PP{})
if err != nil {
return err
for i, stmt := range stmts {
log.Info().Msgf("SQL-Migration of [%s]: %d/%d", db.name, i+1, len(stmts))
_, err := tx.Exec(tctx, stmt, sq.PP{})
if err != nil {
return err
}
}
schemHashDBAfter, err := sq.HashSqliteDatabase(tctx, tx)