# My SQLite database resets after every deploy.

URL: https://antideploy.com/blog/sqlite-database-resets-after-a-deploy

SQLite stores your data in a file on the app's disk. That disk is replaced on every deploy, so the data is gone. Use Postgres.

## At a glance

- **What happened**: The file was on a temporary disk
- **The fix**: Use Postgres
- **It survives deploys**: The database belongs to the app
- **Flagged before build**: Antideploy warns about SQLite

Published 7 October 2026. Facts checked 7 October 2026. 1 min read.

## The short answer

SQLite keeps its whole database in a file next to your app. On Antideploy, the disk that file lands on is temporary: it is wiped whenever the app restarts, redeploys or scales to zero. Nothing errors, and the data is simply gone. Move to Postgres. Antideploy creates one beside your app, and it survives every deploy.

## How to tell

- **A `.db` or `.sqlite` file, or `better-sqlite3` or `sqlite3` in your code.** Antideploy flags SQLite before it builds, because the app deploys fine, reports healthy and loses data.
- **Your data is back to the starting state after a deploy.** Users, rows or settings reset.

## How to fix it

### 1. Ask your agent to switch to Postgres

Say: "Replace SQLite with Postgres." Your agent creates the database, sets `DATABASE_URL` and changes the code. Antideploy can create the database for you, but the code has to be changed to use it.

### 2. Move any existing data

Export the rows you want to keep from the SQLite file, and import them into Postgres.

### 3. Deploy

The database belongs to the application and every deploy reuses it. Only the container's disk is replaced.

See [how to add a Postgres database to your app](https://antideploy.com/blog/how-to-add-a-postgres-database-to-your-app).

## Here's where it stops.

A platform that only tells you what it is good at is one you find the edges of in production. These are the ones to know before your first deploy.

### The disk forgets

Anything written to local disk is gone on the next deploy. Apps that speak S3 get a bucket instead.

### Postgres only

Antideploy creates Postgres databases. Redis, MySQL and MongoDB are not provided today, so an app that needs one brings its own.

## SQLite questions, answered.

Anything else? Write to us and a person answers.

[support@antideploy.com](mailto:support@antideploy.com)

### Can I keep SQLite and save the file somewhere safe?

Not on Antideploy's disk. A file in a bucket is not a database that a running app can use directly, so Postgres is the better choice.

### Is SQLite fine for a demo?

It deploys, and it works until the next restart or deploy. For anything you want to keep, use Postgres.

### Does it cost extra to use Postgres?

No. The databases in your plan are included: 1 on Free and Go, 3 on Pro and 5 on Scale.

## More guides, and the platform.

Each platform page covers one part of Antideploy: what it does, where it stops and the questions people ask. [See the whole platform](https://antideploy.com/platform), or [all the guides](https://antideploy.com/blog).

- [How to add a Postgres database to your app](https://antideploy.com/blog/how-to-add-a-postgres-database-to-your-app): Ask your agent. A Postgres 17 database is created beside your app and DATABASE_URL is set.
- [My uploaded files disappeared after I deployed](https://antideploy.com/blog/uploads-disappear-after-a-deploy): Files saved to the app's disk are gone after a deploy, with no error. Use a private bucket instead.
- [relation "users" does not exist](https://antideploy.com/blog/relation-does-not-exist-database-tables-missing): The database exists but the tables do not. Your migration did not run, or was not detected.

- [Database](https://antideploy.com/platform/database)
- [Deployments](https://antideploy.com/platform/deployments)
- [Hosting](https://antideploy.com/platform/hosting)

Facts on this page were checked against the live platform on 7 October 2026.

## Deploy something. Start with one sentence.

Paste one sentence into your coding agent, click Approve once, and get a live link. No card, no trial clock.

To set this up, give your coding agent this sentence:

```text
Set this project up to deploy on Antideploy. Fetch https://antideploy.com/agent.md and follow it.
```
