🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Database download and upload
This page was created by Lars.olofsson on 2017-05-15. Last edited by Wikiadmin on 2026-07-29.

You can snapshot, download, and replace the MDrivenServer Admin database from MDriven Designer when you need a restore point while testing a Turnkey site or MDrivenServer application.

What this feature does

An Admin database snapshot is a copy of the database that MDrivenServer uses for application administration. The Admin database stores the model and its metadata, user accounts, roles, and access rights.

Use this feature before a test that may change or remove model content. For example, take a snapshot before uploading a model that deletes a class. If you later decide to undo the test, upload the snapshot and download the model again to return to the saved state.

This feature replaces the Admin database on the selected server. It is useful as a restore point for testing, but it is not a complete backup strategy for every database configuration. For a full backup and restore process, including model data, see Documentation:MDriven Backup & Restore Guide.

Understand what is included

MDriven applications can store data in different places. Check where your application stores its business data before relying on an Admin DB snapshot.

Storage location What the Admin DB snapshot covers What you should do
Built-in or embedded database The snapshot can include the data stored in that database along with the Admin database content. Use the snapshot as a restore point, and verify the restored application after upload.
External user database, such as PostgreSQL, MySQL, or Microsoft SQL Server The Admin DB snapshot does not restore the external database's business data. Back up the external database separately. See Documentation:Configuring Production Databases PostgreSQL MySQL MSSQL.

For example, if an application uses an external PostgreSQL database, restoring an Admin DB snapshot can restore the saved model and administrative content, but it does not roll the PostgreSQL business data back to the time of the snapshot.

Before you start

  • Make sure you select the correct MDrivenServer or Turnkey site. Uploading a snapshot replaces the Admin database for that selected site.
  • Save the downloaded snapshot in a clearly named, protected folder. Include the site name and date in the folder or file name.
  • Take a snapshot before uploading a changed model, upgrading, or performing a destructive test.
  • Ensure the target Turnkey deployment has a version that supports Admin DB snapshot and replacement. Update the deployment before using this workflow when necessary.
  • If you also need to preserve model data or use an external database, follow Documentation:MDriven Backup & Restore Guide in addition to this procedure.

Create and download an Admin DB snapshot

  1. Start MDriven Designer.
  2. Open the Cloud Connection dialog by clicking the Cloud Connection icon.
  3. Connect to the target MDrivenServer. Enter the required user name, password, and MDrivenServer URL if they are not already configured.
  4. Select the site or server you want to protect.
  5. Open the Admin DB Access and Swap tab.
  6. Click Snapshot Admin DB.
  7. Wait for the snapshot operation to finish. A message such as 502 Bad Gateway expected due to server forced restart can appear in the MDrivenServer status area. This response is expected because the server is restarted to access the database file.
  8. Check the server status. Wait for MDrivenServer to return to a running state. If it does not start after a short wait, restart MDrivenServer and check its status again.
  9. Click Download Snapshot Admin db.
  10. Choose a local folder and save the downloaded snapshot.

Keep the downloaded file unchanged. It is the restore point you will select if you need to undo later changes.

Replace the Admin database with a downloaded snapshot

Replacing the Admin database overwrites the current Admin database on the selected server. Do this only when you intend to restore that server to the state represented by the snapshot.

  1. Open MDriven Designer and connect to the target server in the Cloud Connection dialog.
  2. Verify that you selected the intended site or server.
  3. Open the Admin DB Access and Swap tab.
  4. Choose the local Admin DB snapshot file that you previously downloaded.
  5. Click Upload Admin db for replace.
  6. Expect the server to restart. A 502 Bad Gateway response is expected during this forced restart.
  7. Check the server status and wait until MDrivenServer is running again. Restart MDrivenServer if it does not return to a running state.
  8. Download the model from the server if you need a local copy of the restored model.
  9. Open the application and verify the restored ViewModels, actions, users, and data that is stored in the Admin or embedded database.

For example, if a test model upload removed a class and its related ViewModel and action, uploading the pre-test snapshot restores the saved Admin database. Download the model again from the server, then refresh the application to verify that the ViewModel and action are available.

Read or inspect a downloaded database

A downloaded Admin database is a database file. If you need to open the built-in database for inspection, follow Documentation:MDrivenServer, opening the built-in database.

Do not edit a snapshot file unless you understand the database format and have another unchanged copy. Keep the original download as the recovery artifact.

Limits and recovery guidance

See also

Test data for automated testing

Test data for automated testing

You can prepare repeatable test data for automated Selenium tests by saving a known baseline before a test run and restoring that baseline after tests change data.

A test-data baseline is the model, administrative content, and business data in a known state that a test expects before it starts. For example, if a Selenium test creates a customer and then checks that the customer appears in a ViewModel, the baseline must contain the users, roles, and any starting records that the test requires.

Choose the data to preserve

Application storage Preserve before the test run Restore for the next run
Admin database with embedded business data An Admin DB snapshot Upload the downloaded Admin DB snapshot.
External PostgreSQL, MySQL, or Microsoft SQL Server database An Admin DB snapshot and a Model Data XML export Upload the Admin DB snapshot, then load and save the Model Data XML export.

An Admin DB snapshot preserves the model and administrative content, including user accounts, roles, and access rights. It does not restore business data in an external database. See Documentation:MDriven Backup & Restore Guide and Documentation:Configuring Production Databases PostgreSQL MySQL MSSQL.

Create a baseline for a test

  1. Configure the target test site with the model, users, roles, and business records that the test needs.
  2. In MDriven Designer, open the Cloud Connection dialog and create and download an Admin DB snapshot as described in Create and download an Admin DB snapshot.
  3. If the application uses an external database, click the System Prototype icon in MDriven Designer.
  4. Open the MDriven Server tab and click Start System.
  5. Click Migrate, then click the download button to export all Model Data to an XML file.
  6. Store the Admin DB snapshot and, when applicable, the Model Data XML file together in a protected baseline folder.

For example, keep a baseline named CustomerSearch-Baseline containing the Admin DB snapshot and the Model Data XML export. Run a Selenium test that creates a customer against this baseline, then restore the same files before the next run.

Reset the test site

  1. Stop or complete the test run before replacing the Admin database.
  2. In MDriven Designer, upload the baseline Admin DB snapshot by following Replace the Admin database with a downloaded snapshot. Wait until MDrivenServer is running again.
  3. If the application uses an external database, click the System Prototype icon and open the MDriven Server tab.
  4. Click Start System, then click Migrate.
  5. Click the button that reads the Model Data XML file and select the baseline export.
  6. Click Chunk Save to upload the data to MDrivenServer.
  7. Click Save in the System Prototyper window to persist the loaded data permanently into the database.
  8. Run the automated test from the restored baseline.

Keep an unchanged copy of each baseline. Do not rely on an Admin DB snapshot alone when the application uses an external user database.

Run tests with predictable data

Selenium Testing supports running tests from Selenium IDE and from the command-line runner. Before each automated run, reset the site to the baseline that matches the test. When running tests in parallel, make sure the tests do not depend on the same changed records; a shared baseline is restored as a server-level operation.

See also