On a Linux build:
Build the sqlite_shell target. This will build the SQLite CLI.
$ ninja -C out/Debug/ sqlite_shell
Run Chrome/Chromium with a fresh profile directory and immediately quit. It doesn‘t really matter how long you run it, but there’ll be less work for you if you quit early.
$ out/Debug/chrome --user-data-dir=foo
Locate the History file in the user-data-dir directory; e.g., foo/Default/History.
Dump the History database into a text file:
$ echo '.dump' | out/Debug/sqlite_shell foo/Default/History > history.sql
Manually remove all INSERT INTO statements other than the statements populating the meta table.
In the past, we only added a history.57.sql file to the repo while adding a migration to the NEXT version 58. That's confusing because then the developer has to reverse engineer what the migration for 57 was. If you introduce a new migration, add a test for it in HistoryBackendDBTest, and add a new history.N.sql file for the new DB layout so that HistoryBackendDBTest.VerifyTestSQLFileForCurrentVersionAlreadyExists keeps passing. SQL schemas can change without migrations, so make sure to verify the history.N-1.sql is up-to-date by re-creating. The flow to create a migration N should be:
history.N-1.sql.history.N-1.sql to make sure it hasn't changed since it was created.N.NEW MIGRATION TESTS GO HERE, beginning with CreateDBVersion(n-1) and ending with ASSERT_GE(HistoryDatabase::GetCurrentVersion(), n);history.N.sql. Then run git cl presubmit to get a command to add the new file to a filelist in this directory.