Skip to main content
Browse docs

Copy development data to production

Replace production's database and uploaded files with development's, or add missing database structure to production while keeping its data.

On this page

Production starts with an empty database, and releases never change its data. When you want production to start with what you've set up in development, or to reset it to known data before real customers arrive, an owner can copy development's data across.

Warning: Copying permanently deletes every record and uploaded file in production and replaces them with development's. 1904 doesn't keep a backup of what's replaced. Don't copy once real customers are using production.

Before you copy

  • Only owners can copy data or fix production's schema.
  • Production is stopped during the copy and started again afterward. If the copy fails, production keeps its current data and files.
  • Both databases need the same structure, or you approve production taking development's. The copy checks this for you.

Copy the data

  1. Open the Settings of either app and select Production.
  2. In Copy development data to production, select Copy development data to production….
  3. In Overwrite all production data?, review what will be copied:
    • Files (uploads and other stored files) shows how many files each app has.
    • If uploads were saved inside development's code folder, they're listed under Also found in development’s code folder. Tick the folders production should get.
    • The database check compares the two structures. See below if they differ.
  4. Tick I understand that all production data will be overwritten and cannot be recovered. and select Continue.
  5. In Final confirmation, type the production app's name into Production app name and select Overwrite production data.

The section shows that the copy is running and production is stopped. When it finishes, you get a notification, and the section shows when the last copy finished and who started it.

The Overwrite all production data? dialog with the file counts, the database check and the confirmation checkbox

If the database structures differ

The check lists each difference and the likely cause. You can either:

  • Fix production's schema first, which keeps this a plain data copy (see below), or
  • Tick I approve these changes: production takes development’s database structure along with its data.

Fix production's schema without copying data

Sometimes production's database is missing structure that development has, for example after a migration that didn't finish. Production database schema adds what's missing and keeps production's data.

  1. Select Check production’s schema.
  2. If there are differences, read them and the likely cause.
  3. Select Fix production’s schema, open the SQL to see exactly what will run, and tick the confirmation.
  4. Select Apply to production.

The fix only adds to production's database. Nothing is removed or changed, and it applies all at once or not at all. Adding indexes can briefly pause writes to those tables. Differences that would remove or change something in production are left for you to review.

History

Each copy and schema fix is recorded under History in the copy section, with when it started and finished, what it did, who ran it and how it went.