Update your site with a new ZIP: what BrewInTH does with your .sql

A new ZIP with a .sql file leaves your data alone: new tables and columns are added for you, and data changes wait on a card with a backup first.
You asked ChatGPT to improve the cake shop site you already host on BrewInTH: products should have a stock count, and there are two new categories. ChatGPT sent back new code and an updated database.sql. Meanwhile the live site holds two hundred real orders. If you zip the new files and send them up again, do those orders survive? And does the stock column end up in the database by itself?
This guide explains what BrewInTH does with the .sql file when you send a new set of files to the same project through Upload & go live: what runs on its own, what waits for you, how to recover if something goes wrong, and a message you can paste to your AI so it writes the file the way the platform can use.
In short
✅ A new ZIP sent to the same project leaves the site's data alone: the.sqlfile is not imported again as a whole
🧱 New tables, new columns and new indexes are added for you before the new version starts
🖐️ Statements that write or change data, such as INSERT, UPDATE and DROP, wait for you on the SQL statements not run yet card
🛟 Whenever you run them, the database is backed up first, on every package, with no add-on needed
✍️ A new column has to be written asALTER TABLE … ADD COLUMN; adding it inside the old CREATE TABLE does nothing to a table that exists
The first upload imports everything; later ones protect your data
On the first release the database is empty, so the .sql file in the ZIP is imported whole. Once the site is live and people use it, sending a new set to the same project replaces the code but does not import the .sql file again: that could overwrite real orders and sign-ups. Instead the platform reads the file statement by statement and sorts it into three groups.
This applies to sites updated through Upload & go live that use MySQL, MariaDB or PostgreSQL. A site that an AI agent looks after with a token leaves the database to the agent (let your AI import a whole .sql file).

- Added for you: CREATE TABLE for tables the site does not have yet (created empty; existing tables are untouched because it runs as IF NOT EXISTS), ALTER TABLE statements that only add, such as
ADD COLUMNandADD INDEX, and CREATE INDEX. These run before the new version starts. A column or index that is already there counts as skipped, not failed; a statement that really fails is noted and the release goes ahead. - Waiting for you: everything that does more than add, such as INSERT, UPDATE, DELETE, DROP, TRUNCATE and ALTER TABLE statements that drop, retype or rename columns. They are kept on the SQL statements not run yet card. Session lines such as SET and COMMIT are skipped.
- A whole copy of the database: a file with DROP TABLE and CREATE TABLE for the same tables, the way phpMyAdmin, cPanel and WordPress export, including a file where your AI starts each table with
DROP TABLE IF EXISTS. Such a file gets a single button: Import this file in place of the database (backup first).
What the result page tells you
Pick the same project under 1. Choose the project, hand over the ZIP and press Update. The progress list gains a New tables/columns row with three numbers: added, already there (skipped) and failed. The first number counts every statement that ran, including the CREATE TABLE of tables you already had. Under What the platform did, each file gets a line like this:
database.sql: only tables that do not exist yet are created (4 CREATE TABLE statement(s), as IF NOT EXISTS) and the columns/indexes the file adds (1 ALTER/CREATE INDEX statement(s); ones already there are skipped); existing tables and their data are untouched · the file's other statements were not run (INSERT 3) — the "run the remaining statements" button runs them after a backup of the database
Once the site is live, the SQL statements not run yet card appears below the progress list, and it stays on the project's Databases tab until you decide.
The "SQL statements not run yet" card: read it before you press
The card shows the file name, a count per kind of statement such as INSERT 3, and the status Waiting for you. Show the statements lists the statements themselves (the first 30). The run button runs every statement on the list in one go; you can't pick some of them.

So look at what's on the list first:
- Everything is new and this version needs it, such as new categories or the starting values of a new feature. Run it, and soon: the pages that use these rows stay empty until you do.
- Old sample rows are mixed in. If the file still carries the sample data imported on the first release, the card lists those INSERTs too: the first release imported the file whole and kept no record of single statements. Running them can duplicate rows or fail on taken ids. Press Dismiss, then have your AI take the sample data out and send the files again.
- There's an UPDATE, DELETE or DROP. Read each one. If you're unsure, paste it to your AI and ask what it changes.
When you press Run the remaining statements (backup first):
- If the list holds a DROP, TRUNCATE, DELETE, UPDATE or an ALTER that drops or changes columns, the page asks once more. Press Confirm when you're ready.
- The status reads Backing up, then running…: the database is backed up first as a Before SQL run copy. If the backup fails, nothing runs.
- The statements run one by one, in order. A failing statement is skipped and the rest carry on; the ones that already ran are not undone.
- The status ends as Run. If anything failed, the card says how many, with the error messages to copy to your AI.
Statements that ran successfully are remembered and not offered again. Dismiss closes the card without running anything.
A whole copy of the database: press only to replace the data on purpose
The card for a group-three file says whole copy of the database, with its number of tables. Tables the site didn't have are already created, empty; your data is untouched until you press the button. Import this file in place of the database (backup first) replaces every table that is in the file, whole, with the file's rows; tables the file doesn't mention stay as they are. It's meant for when you really want the file's data instead, such as the final move from your old host (moving from cPanel with one backup file).
Don't press it in two cases:
- It's the same old file from day one that rides along in every ZIP. The tables in it would go back to that day's data, and whatever the site gathered since would be gone. If you're only updating the code, leave the
.sqlfile out of the ZIP, or press Dismiss. - It's a schema file with no rows, such as
DROP TABLE IF EXISTSfollowed byCREATE TABLEwritten by your AI. The tables in it would come back empty.
If you do mean it, press Confirm in the box that names the database and the number of tables. The database is backed up as Before SQL run, then the whole file is imported. If every statement goes through, the status reads Imported, and the same file won't be offered again. If even one statement fails, the platform puts the earlier data back from the Before SQL run copy by itself and restarts the app; the card says Import failed — the earlier data is back and lists the failing lines. Fix the file and send it again, or press Import again, skipping the failing lines if you accept that those tables end up incomplete: there's still a backup first, but nothing is put back by itself this time.
Have your AI write the .sql file so it works first time
The most common mistake is an AI adding the new column inside the existing CREATE TABLE. That works on a machine that builds the database from scratch every time, but on a site whose tables already exist, CREATE TABLE as IF NOT EXISTS leaves the table as it is. The column never appears, and the new version fails with "Unknown column".

- Write new columns and indexes as ALTER TABLE, and give every new column a DEFAULT so existing rows get a value.
- Keep the ALTER in the same file as the CREATE TABLE statements, at the end of
database.sqlfor example. A.sqlfile with no CREATE TABLE or INSERT at all is not picked up, and the result page doesn't mention it. - Leave DROP TABLE out of the file of a site that holds data.
- Write starting rows so a second run adds nothing. Give them an id and use
INSERT IGNOREon MySQL orON CONFLICT DO NOTHINGon PostgreSQL, and take the old sample data out.
The end of a database.sql the platform can use right away:
-- existing table, left as it was
CREATE TABLE products (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(200) NOT NULL,
price DECIMAL(10,2) NOT NULL,
category_id INT
);
-- new in this version
ALTER TABLE products ADD COLUMN stock INT NOT NULL DEFAULT 0;
INSERT IGNORE INTO categories (id, name) VALUES (7, 'Birthday cakes'), (8, 'Bread');
The platform adds that ALTER on its own before the new version starts. The INSERT waits on the card, and running it can't create duplicates: rows whose id already exists are skipped.
A message to paste when you ask your AI for changes:
Please make the changes we discussed and give me the new set of files as a ZIP. I will use it to update my existing site on BrewInTH through the "Upload & go live" page.
The site is live and holds real data, and the platform does not import the .sql file again as a whole, so please write the .sql file like this:
- Keep the CREATE TABLE statements of existing tables exactly as they are. Do not add or change columns inside the CREATE TABLE of a table that already exists.
- Write new columns or indexes as ALTER TABLE ... ADD COLUMN or ADD INDEX at the end of the same .sql file, and give new columns a DEFAULT.
- New tables can use a plain CREATE TABLE. No DROP TABLE, no TRUNCATE, and no DELETE or UPDATE without WHERE.
- Remove the old sample data from the file. Starting rows that are new must have an id and be written so that running them twice adds nothing (INSERT IGNORE on MySQL, ON CONFLICT DO NOTHING on PostgreSQL).
- Tell me what this version changes in the database, and which INSERT, UPDATE or DELETE statements I need to run myself after the site is live.
When this doesn't apply
- Sites that use their framework's migrations, such as Laravel, Django or Prisma: the framework's migrate command runs before each release and the
.sqlfile isn't used at all. Ask your AI for a migration instead (deploying Laravel / PHP). - Files in migration folders such as
migrations/,drizzle/andsupabase/are not picked up. - A database that never received data successfully, for example because the first set had no
.sqlfile: this set's file is imported whole, like a first release, and What the platform did says so. - Files larger than 16 MB, or with DELIMITER blocks for procedures and triggers, are not split into statements. Only missing tables are created: no new columns and no card. If you need such a file, talk to the team.
- The very file you already imported in place of the database is not offered again; the summary says when it went in.
- SQLite and MongoDB don't go this way. A site that keeps its data in an SQLite file uses the Use the data files of this archive instead of the site's checkbox instead.
Something went wrong: how to get the data back
Every run or import from the card first takes a Before SQL run backup. You'll find it on the Databases tab, in the Backups panel, and every package can Restore it; the Backups add-on isn't needed (that add-on, ฿99 a month, adds daily backups and the Back up now button).
- If a statement failed after a DROP or DELETE on the same table had gone through, the card reads Failed and offers Restore the backup taken before the run; press it, then Confirm restore.
- Before restoring, the platform takes one more copy of the data as it is then (Before restore), and it restarts the app when the restore is done.
- Anything that came in after the backup, such as new orders, disappears from the site when you restore, though it's still in the Before restore copy. The sooner you decide, the less you lose.
After a run or a restore, check the data in the Database browser on the same tab (browse and fix your database from the console).
FAQ
Will a new ZIP wipe my existing orders and members?
No, as long as you send it to the same project and don't press the button that imports a file in place of the database. On its own, the platform only adds tables, columns and indexes; it never deletes or changes data.
I pressed Dismiss. Why are the same statements back?
Dismiss closes that one card. The platform only remembers statements that ran successfully, so a file that still holds them brings the card back. Ask your AI to remove them from the file.
The new version says a column doesn't exist, but my AI says it added it
Check the New tables/columns row on the result page. If nothing failed, the column was most likely written inside a CREATE TABLE; ask your AI to add it as ALTER TABLE … ADD COLUMN at the end of the file and send the files again. If something failed, copy the error to your AI.
Can I run the statements myself in the SQL box instead?
Yes, one at a time, but the SQL box takes no backup first. If you want one, use the card's button, or press Back up now first, which needs the Backups add-on.
Summary
You can send a new ZIP to the same project without fear for your data. New tables, columns and indexes are added for you before the new version starts. Statements that change data wait for you to read and run on the SQL statements not run yet card, with a backup taken first every time. Press the whole-copy button only when you mean to replace the data, and have your AI write new columns as ALTER TABLE at the end of the existing file. For real screenshots step by step, open User guide › Upload a ZIP and go live in the console.
