# rzsql.json

[Home](/rezoom-sql/master.md) > [Configuration](/rezoom-sql/configuration.md) > rzsql.json

[← Configuration](/rezoom-sql/configuration.md) | [Runtime configuration →](/rezoom-sql/configuration/configuration.md)

## rzsql.json

The RZSQL type provider is configured in a file called rzsql.json. If you're using a Visual Studio project to build an F# assembly, this file must be present in your project folder. If you're using an F# script file (.fsx), rzsql.json should be in the same folder as your script.

Currently there are just a few configuration options to set in here. A complete rzsql.json looks like this:

```javascript
{
  "backend": "tsql",
  "connectionname": "rzsql",
  "optionals":  "f#",
  "migrations": "."
}
```

All options are case-insensitive.

### Backend

*default: `"rzsql"`*

This is the most important option, and in fact for most projects this is the only one you need to define. The defaults are fine for the others.

The backend setting tells RZSQL what database system you are going to use. This determines:

* The syntax it'll translate to at compile time (e.g. converting `LIMIT 1` to `SELECT TOP 1`)
* The set of SQL functions (such as `SQRT`, `SUM`, etc.) available to your queries
* The [data types](/rezoom-sql/language/datatypes.md) supported
* The logic used for setting up the migration history table and running migrations

Currently there are four possible values for the `"backend"` setting:

| "backend"  | RDBMS                                     |
| ---------- | ----------------------------------------- |
| "sqlite"   | [SQLite](https://www.sqlite.org/)         |
| "tsql"     | Microsoft SQL Server                      |
| "postgres" | [PostgreSQL](https://www.postgresql.org/) |
| "rzsql"    | None (no translation)                     |

The default "rzsql" backend is never what you want for a real application. It outputs RZSQL's own syntax, although not necessarily exactly what was written (for example, `*` wildcards will be expanded at compile time). It also does not have any SQL functions.

Be aware that the `"tsql"` backend assumes you have SQL Server 2012 or newer, because it uses the OFFSET/FETCH syntax to translate `LIMIT x OFFSET y` clauses. If you don't use that clause, it may work on older versions of SQL Server, but is not tested.

### ConnectionName

*default: `"rzsql"`*

This setting determines the connection string name RZSQL will use at runtime. By default this is resolved as `ConnectionStrings:{name}` in the host's `IConfiguration` (e.g. your `appsettings.json`). See [Runtime configuration](/rezoom-sql/configuration/configuration.md) for details.

There is usually no reason to change the default.

### Optionals

*default: `"f#"`*

This setting controls what .NET types the type provider will use to represent values that could be null.

The default setting is to use F#'s [option type](https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/options) for all nullables.

You can set this to `"c#"` to generate types more familiar to C# developers. When using the `"c#"` setting, reference types like `string` will be left alone, since they can already be null. Value types like `int` will be wrapped in `System.Nullable<T>`, a.k.a. `int?` in C# syntax.

I recommend sticking to the default F# style, since in C# style, you cannot tell whether a string parameter or result set column has been inferred to be nullable or not. It's better to know when you have to handle the possible null case.

### Migrations

*default: `"."`*

This setting controls the folder where RZSQL will look for migration scripts. Any file under this folder whose name matches the regex `@"V[0-9]+.*\.sql"` (case-insensitive) is assumed to be a migration script.

This path is interpreted relative to the folder where rzsql.json is located. This means that the default is to look for migration scripts in the same folder as rzsql.json.

Since it is painful to use sub-folders in F# projects, the default setting is recommended if you want to have your migration scripts be part of your project file (which is also recommended!).

***

[← Configuration](/rezoom-sql/configuration.md) | [Runtime configuration →](/rezoom-sql/configuration/configuration.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://humbobst.gitbook.io/rezoom-sql/configuration/json.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
