Table Deletion, Backups & Restoration - lokothodida/DM_Matrix GitHub Wiki
Deletion
Sometimes you'll want to get rid of your table completely from the schema. Doing so from within and outside of The Matrix is hassle-free.
Within The Matrix
You can do so from two places: the main screen or the view screen of the table. From the main screen, simply click the 'x' on the rightmost column. You will be provided with a prompt asking you if you are sure that you wish to do so. Click 'yes' and the action will follow through.
From the table view, you will see several options on the right hand side of the table headings, including 'COPY' and 'EMPTY'. Click 'delete' and the same process will be done.
Outside of The Matrix
Outside, all you need to do is call upon the deleteTable method.
<?php
$var->deleteTable('foo');
?>
Backup & Restore
As with any data-structure, the ability to back up the existing state of the structure is vital to its integrity. If something goes wrong, you need to be able to revert back to previous iterations to find out what caused the problem.
Within The Matrix
From the table view, click the 'BACKUP' tab. There you will see a list of the existing backups (if there are any).
Click 'Create Backup' to create a new backup of the current state of the table and its schema.
The backups are stored as .zip files that you can download from the server at any time via FTP from the data/other/matrix directory.
Clicking 'x' will delete said backup from the server. Clicking '#' will restore the table to the state of that specified .zip file (all newly created records since the backup's creation will be deleted).
Outside of The Matrix
backupTable and restoreTable are the two relevant methods to call upon in this case.
<?php
$var->backupTable('foo'); // backs up foo
$var->restoreTable('foo'); // restores foo to the latest backup
$var->restoreTable('foo', $directory, $file); // restores foo to the backup specified in
// the $directory with filename $file
// (no .zip extension)
?>