(t *testing.T)
| 673 | } |
| 674 | |
| 675 | func TestLocalMigration7_trash(t *testing.T) { |
| 676 | // set up |
| 677 | db := database.InitTestMemoryDBRaw(t, "./fixtures/local-7-pre-schema.sql") |
| 678 | ctx := context.InitTestCtxWithDB(t, db) |
| 679 | |
| 680 | b1UUID := testutils.MustGenerateUUID(t) |
| 681 | database.MustExec(t, "inserting trash book", db, "INSERT INTO books (uuid, label) VALUES (?, ?)", b1UUID, "trash") |
| 682 | |
| 683 | // Execute |
| 684 | tx, err := db.Begin() |
| 685 | if err != nil { |
| 686 | t.Fatal(errors.Wrap(err, "beginning a transaction")) |
| 687 | } |
| 688 | |
| 689 | err = lm7.run(ctx, tx) |
| 690 | if err != nil { |
| 691 | tx.Rollback() |
| 692 | t.Fatal(errors.Wrap(err, "failed to run")) |
| 693 | } |
| 694 | |
| 695 | tx.Commit() |
| 696 | |
| 697 | // Test |
| 698 | var b1Label string |
| 699 | var b1Dirty bool |
| 700 | database.MustScan(t, "scanning b1 label", db.QueryRow("SELECT label, dirty FROM books WHERE uuid = ?", b1UUID), &b1Label, &b1Dirty) |
| 701 | assert.Equal(t, b1Label, "trash (2)", "b1 label was not migrated") |
| 702 | assert.Equal(t, b1Dirty, true, "b1 was not marked dirty") |
| 703 | } |
| 704 | |
| 705 | func TestLocalMigration7_conflicts(t *testing.T) { |
| 706 | // set up |
nothing calls this directly
no test coverage detected