Next: , Previous: Packet I/O, Up: Command Reference



5.8 Database

monotone db init --db=dbfile
This command initializes a new monotone database at dbfile.
monotone db rebuild --db=dbfile
This command rebuilds the ancestry graph of the monotone database at dbfile, which may become necessary if future bugs in monotone allow invalid changesets to be saved in your database. This command is destructive, and you should make a backup copy of your database before running it. It will preserve the contents of each revision, but it will lose rename history. Use it carefully, and only after understanding Rebuilding ancestry. Note that it will make your history incompatible with that of anyone else working on the same project! Read Rebuilding ancestry.
monotone db info --db=dbfile
This command prints information about the monotone database dbfile, including its schema version and various table size statistics.
monotone db version --db=dbfile
This command prints out just the schema version of the monotone database dbfile.
monotone db dump --db=dbfile
This command dumps an SQL statement representing the entire state of dbfile to the standard output stream. It is a very low-level command, and produces the most “recoverable” dumps of your database possible. It is sometimes also useful when migrating databases between variants of the underlying sqlite database format.
monotone db load --db=dbfile
This command applies a raw SQL statement, read from the standard input stream, to the database dbfile. It is most useful when loading a database dumped with the dump command.

Note that when reloading a dumped database, the schema of the dumped database is included in the dump, so you should not try to init your database before a load.

monotone db migrate --db=dbfile
This command attempts to migrate the database dbfile to the newest schema known by the version of monotone you are currently running. If the migration fails, no changes should be made to the database.

If you have important information in your database, you should back up a copy of it before migrating, in case there is an untrapped error during migration.

monotone db check --db=dbfile
Monotone always works hard to verify the data it creates and accesses. For instance, if you have hard drive problems that corrupt data in monotone's database, and you attempt to retrieve this data, then monotone will notice the problem and stop, instead of silently giving you garbage data.

However, it's also nice to notice such problems early, and in rarely used parts of history, while you still have backups. That's what this command is for. It systematically checks the database dbfile to ensure that it is complete and consistent. The following problems are detected:

This command also verifies that the sha1 of every file, manifest, and revision is correct.

monotone db execute sql-statement
This is a debugging command which executes sql-statement against your database, and prints any results of the expression in a tabular form. It can be used to investigate the state of your database, or help diagnose failures.