-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23ff09c
commit 6b77971
Showing
1 changed file
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
``` |