|
1 | 1 | # loopback-connector-sqlite3 |
2 | 2 |
|
3 | | -The official SQLite3 connector module for the LoopBack framework. |
| 3 | +[SQLite](https://sqlite.org/) is a self-contained, high-reliability, embedded, full-featured, public-domain, SQL database engine. This is the official SQLite3 connector module for the LoopBack framework. |
4 | 4 |
|
5 | | -## Connector settings |
| 5 | +## Installation |
6 | 6 |
|
7 | | -The connector can be configured using the following settings from the data source. |
8 | | -* file: The path to the database file or `:memory:` |
9 | | -* debug (default to false) |
| 7 | +Enter the following in the top-level directory of your LoopBack application: |
10 | 8 |
|
11 | | -The SQLite3 connector uses [node-sqlite3](https://github.com/mapbox/node-sqlite3) as the driver. |
| 9 | +``` |
| 10 | +$ npm install loopback-connector-sqlite3 --save |
| 11 | +``` |
| 12 | + |
| 13 | +The `--save` option adds the dependency to the application's `package.json` file. |
| 14 | + |
| 15 | +## Connector settings |
12 | 16 |
|
13 | | -## Discovering Models |
| 17 | +Configure the connector with the following data source properties: |
14 | 18 |
|
15 | | -The SQLite3 connector does not currently support discovery of models. |
| 19 | +* `file`: The path to the database file or `:memory:` |
| 20 | +* `debug`: Display debug information. Default is false. |
| 21 | + |
| 22 | +The SQLite3 connector uses [node-sqlite3](https://github.com/mapbox/node-sqlite3) as the driver. |
16 | 23 |
|
17 | 24 | ## Model definition for SQLite3 |
18 | 25 |
|
@@ -76,23 +83,25 @@ The model definition consists of the following properties: |
76 | 83 |
|
77 | 84 | ## Type Mapping |
78 | 85 |
|
79 | | - - Number |
80 | | - - Primary key is stored as INTEGER |
81 | | - - Others are stored as REAL |
82 | | - - Boolean |
83 | | - - Stored as INTEGER 1 or 0 |
84 | | - - Date |
85 | | - - Stored as INTEGER (Millis since Jan 01 1970 00:00:00 0000) |
86 | | - - String |
87 | | - - Complex types (GeoPoint, Point, List, Array, Object, Sub-models) |
88 | | - - Stored as TEXT in JSON form |
89 | | - - JSON |
90 | | - - Stored as TEXT |
91 | | - |
92 | | -SQLite3 does not enforce types. I.e. any data can be stored in any column regardless of definiton. |
| 86 | +| LoopBack type | Mapped to SQLite3 type | |
| 87 | +|-----|-----| |
| 88 | +| Number| Primary key stored as INTEGER, others as REAL | |
| 89 | +| Boolean | INTEGER 1 or 0 | |
| 90 | +| Date | INTEGER (ms since Jan 01 1970 00:00:00 0000) | |
| 91 | +| String | ? | |
| 92 | +| Complex types: GeoPoint, Point, List, Array, Object, and sub-models | TEXT in JSON format | |
| 93 | +| JSON | TEXT | |
| 94 | + |
| 95 | +SQLite3 does not enforce types. Any data can be stored in any column regardless of definiton. |
93 | 96 | This connector attempts to check for invalid Date, Number and JSON types. |
94 | 97 |
|
95 | | -## Auto Migrate / Auto Update |
| 98 | +## Unsupported features |
| 99 | + |
| 100 | +### Discovering Models |
| 101 | + |
| 102 | +The SQLite3 connector does not currently support model discovery. |
| 103 | + |
| 104 | +### Auto Migrate / Auto Update |
96 | 105 |
|
97 | 106 | The SQLite3 connector does not currently support auto-migrate or auto-upgrade. |
98 | 107 |
|
|
0 commit comments