Reading helps - fix upgrade test

This commit is contained in:
Till Faelligen 2022-08-23 09:58:03 +02:00
parent 9ad1375400
commit c63894670e
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E
4 changed files with 8 additions and 4 deletions

View file

@ -76,7 +76,8 @@ func executeMigration(ctx context.Context, db *sql.DB) error {
// column partition was removed from the table
migrationName := "keyserver: refactor key changes"
err := db.QueryRowContext(ctx, "select column_name from information_schema.columns where table_name = 'keyserver_key_changes' AND column_name = 'partition'").Err()
var cName string
err := db.QueryRowContext(ctx, "select column_name from information_schema.columns where table_name = 'keyserver_key_changes' AND column_name = 'partition'").Scan(&cName)
if err != nil {
if errors.Is(err, sql.ErrNoRows) { // migration was already executed, as the column was removed
if err = sqlutil.InsertMigration(ctx, db, migrationName); err != nil {

View file

@ -75,7 +75,8 @@ func executeMigration(ctx context.Context, db *sql.DB) error {
// column partition was removed from the table
migrationName := "keyserver: refactor key changes"
err := db.QueryRowContext(ctx, `SELECT p.name FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p WHERE m.name = 'keyserver_key_changes' AND p.name = 'partition'`).Err()
var cName string
err := db.QueryRowContext(ctx, `SELECT p.name FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p WHERE m.name = 'keyserver_key_changes' AND p.name = 'partition'`).Scan(&cName)
if err != nil {
if errors.Is(err, sql.ErrNoRows) { // migration was already executed, as the column was removed
if err = sqlutil.InsertMigration(ctx, db, migrationName); err != nil {

View file

@ -74,7 +74,8 @@ func executeMigration(ctx context.Context, db *sql.DB) error {
// column event_nid was removed from the table
migrationName := "roomserver: state blocks refactor"
err := db.QueryRowContext(ctx, "select column_name from information_schema.columns where table_name = 'roomserver_state_block' AND column_name = 'event_nid'").Err()
var cName string
err := db.QueryRowContext(ctx, "select column_name from information_schema.columns where table_name = 'roomserver_state_block' AND column_name = 'event_nid'").Scan(&cName)
if err != nil {
if errors.Is(err, sql.ErrNoRows) { // migration was already executed, as the column was removed
if err = sqlutil.InsertMigration(ctx, db, migrationName); err != nil {

View file

@ -82,7 +82,8 @@ func executeMigration(ctx context.Context, db *sql.DB) error {
// column event_nid was removed from the table
migrationName := "roomserver: state blocks refactor"
err := db.QueryRowContext(ctx, `SELECT p.name FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p WHERE m.name = 'roomserver_state_block' AND p.name = 'event_nid'`).Err()
var cName string
err := db.QueryRowContext(ctx, `SELECT p.name FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p WHERE m.name = 'roomserver_state_block' AND p.name = 'event_nid'`).Scan(&cName)
if err != nil {
if errors.Is(err, sql.ErrNoRows) { // migration was already executed, as the column was removed
if err = sqlutil.InsertMigration(ctx, db, migrationName); err != nil {