## Initialization and troubleshooting

### What initialization changes

Dinvolt generates the initial migration after installing dependencies. Initialization accepts only that unchanged initial migration:

| Database state | Result |
| --- | --- |
| Empty | Creates the known initial tables and real migration history together |
| Exact matching schema and history | Read-only readiness check |
| Existing tables, missing history, or schema drift | Stops for manual review |
| Local schema or migrations changed | Stops; use reviewed regular migrations |

Checks compare columns, defaults, indexes, and constraints, under a transaction lock. Matching table names alone are insufficient. PlanetScale also checks that the application endpoint can read the ready auth schema.

Initialization never deletes existing data, adopts unknown tables, or applies future migrations automatically. The setup summary reports connection and schema readiness separately.

### Connection or initialization failed

Your project, credentials, and generated SQL are preserved. Fix the network, permission, or credential issue, then rerun the matching initialization command:

```sh npm
npm run db:init
```

```sh bun
bun run db:init
```

```sh pnpm
pnpm run db:init
```

```sh yarn
yarn run db:init
```

A timeout can leave the commit result uncertain. Retrying inspects the persisted schema/history before taking further action.

### Existing schema is incompatible

Compare the saved SQL with the intended database and its migration history. Use an empty database or prepare a reviewed migration/recovery procedure for its existing data.

Keep unrelated objects and genuine migration history intact. Adding fake history or dropping tables to pass readiness checks can lose data.


