Skip to content

Commit

Permalink
add sqlite connection string docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolasburk committed Feb 19, 2020
1 parent 23ff09c commit 6b77971
Showing 1 changed file with 63 additions and 1 deletion.
64 changes: 63 additions & 1 deletion docs/core/connectors/sqlite.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,65 @@
# SQLite

Coming soon.
The SQLite data source connector connects Prisma to a [SQLite](https://www.sqlite.org/) database file. These files always have the file ending `.db` (e.g.: `dev.db`).

## Example

To connect to a SQLite database file, you need to configure a [`datasource`](../../prisma-schema-file.md#data-sources) block in your [schema file](../../prisma-schema-file.md):

```prisma
datasource sqlite {
provider = "sqlite"
url = "./dev.db"
}
// ... the file should also contain a data model definition and (optionally) generators
```

The fields passed to the `datasource` block are:

- `provider`: Specifies the `sqlite` data source connector.
- `url`: Specifies the [connection string](#connection-string) for the SQLite database file. In this case, the file is located in the same directory and called `dev.db`.

Find more information on the `datasource` fields [here](../../prisma-schema-file.md#data-sources).

## Data model mapping

The SQLite connector maps the [scalar types](../../data-modeling.md#scalar-types) from the [data model](../../data-modeling.md) to native column types as follows:

| Data model | SQLite |
| -------- | --------- |
| `String` | `TEXT` |
| `Boolean` | `BOOLEAN` |
| `Int` | `INTEGER` |
| `Float` | `REAL` |

## Connection details

### Connection string

The connection URL of a SQLite connector points to a file on your file system. For example, the following two paths are equivalent because the `.db` iss in the same directory:

```prisma
datasource sqlite {
provider = "sqlite"
url = "./dev.db"
}
```

is the same as:

```prisma
datasource sqlite {
provider = "sqlite"
url = "dev.db"
}
```

You can also target files from the root or any other place in your file system:

```prisma
datasource sqlite {
provider = "sqlite"
url = "/Users/janedoe/dev.db"
}
```

0 comments on commit 6b77971

Please sign in to comment.