MIGRATE — queues table rows for migration to an export target.
MIGRATE FROM table-name
[WHERE [NOT] boolean-expression [ {AND |
OR} [NOT] boolean-expression]...]
The MIGRATE statement selects rows from the specified table for migration to an export target and marks the rows for deletion. When rows are migrated, they are first exported to the export target defined in the table definition (in the MIGRATE TO TARGET clause). Once the export target acknowledges receipt of the data, the rows are deleted from the VoltDB table.
For example, assume the reservations table contains information about airline reservations. Once the flight is over, you want to archive the reservation records. But you do not want them to be deleted until you are sure they reach the archive. To achieve this you can declare the table using the MIGRATE TO TARGET clause:
CREATE TABLE Reservation
MIGRATE TO TARGET oldreserve
( Reserve_ID INT NOT NULL,
Flight_ID INT NOT NULL,
Customer_ID INT);
Then, when the flight is completed, you can migrate all associated reservations to the external system associated with the oldreserve target, ensuring they are not deleted from the VoltDB database until they reach the target.
MIGRATE FROM Reservation WHERE Reserve_ID= ?;
The MIGRATE statement applies to any tables declared with a MIGRATE TO TARGET clause. You can use MIGRATE to manually migrate rows from tables that do not have an automated "time to live" (USING TTL) value defined or you can use it to preemptively migrate rows in a table declared with USING TTL.