(t *testing.T)
| 703 | } |
| 704 | |
| 705 | func TestLocalMigration7_conflicts(t *testing.T) { |
| 706 | // set up |
| 707 | db := database.InitTestMemoryDBRaw(t, "./fixtures/local-7-pre-schema.sql") |
| 708 | ctx := context.InitTestCtxWithDB(t, db) |
| 709 | |
| 710 | b1UUID := testutils.MustGenerateUUID(t) |
| 711 | database.MustExec(t, "inserting book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "conflicts") |
| 712 | |
| 713 | // Execute |
| 714 | tx, err := db.Begin() |
| 715 | if err != nil { |
| 716 | t.Fatal(errors.Wrap(err, "beginning a transaction")) |
| 717 | } |
| 718 | |
| 719 | err = lm7.run(ctx, tx) |
| 720 | if err != nil { |
| 721 | tx.Rollback() |
| 722 | t.Fatal(errors.Wrap(err, "failed to run")) |
| 723 | } |
| 724 | |
| 725 | tx.Commit() |
| 726 | |
| 727 | // Test |
| 728 | var b1Label string |
| 729 | var b1Dirty bool |
| 730 | database.MustScan(t, "scanning b1 label", db.QueryRow("SELECT label, dirty FROM books WHERE uuid = ?", b1UUID), &b1Label, &b1Dirty) |
| 731 | assert.Equal(t, b1Label, "conflicts (2)", "b1 label was not migrated") |
| 732 | assert.Equal(t, b1Dirty, true, "b1 was not marked dirty") |
| 733 | } |
| 734 | |
| 735 | func TestLocalMigration7_conflicts_dup(t *testing.T) { |
| 736 | // set up |
nothing calls this directly
no test coverage detected