(t *testing.T)
| 643 | } |
| 644 | |
| 645 | func TestLocalMigration6(t *testing.T) { |
| 646 | // set up |
| 647 | db := database.InitTestMemoryDBRaw(t, "./fixtures/local-5-pre-schema.sql") |
| 648 | ctx := context.InitTestCtxWithDB(t, db) |
| 649 | |
| 650 | data := testutils.MustMarshalJSON(t, actions.AddBookDataV1{BookName: "js"}) |
| 651 | a1UUID := testutils.MustGenerateUUID(t) |
| 652 | database.MustExec(t, "inserting action", db, |
| 653 | "INSERT INTO actions (uuid, schema, type, data, timestamp) VALUES (?, ?, ?, ?, ?)", a1UUID, 1, "add_book", string(data), 1537829463) |
| 654 | |
| 655 | // Execute |
| 656 | tx, err := db.Begin() |
| 657 | if err != nil { |
| 658 | t.Fatal(errors.Wrap(err, "beginning a transaction")) |
| 659 | } |
| 660 | |
| 661 | err = lm5.run(ctx, tx) |
| 662 | if err != nil { |
| 663 | tx.Rollback() |
| 664 | t.Fatal(errors.Wrap(err, "failed to run")) |
| 665 | } |
| 666 | |
| 667 | tx.Commit() |
| 668 | |
| 669 | // Test |
| 670 | var count int |
| 671 | err = db.QueryRow("SELECT name FROM sqlite_master WHERE type='table' AND name = ?;", "actions").Scan(&count) |
| 672 | assert.Equal(t, count, 0, "actions table should have been deleted") |
| 673 | } |
| 674 | |
| 675 | func TestLocalMigration7_trash(t *testing.T) { |
| 676 | // set up |
nothing calls this directly
no test coverage detected