Skip to content

Commit

Permalink
fixup! use mysql as example
Browse files Browse the repository at this point in the history
  • Loading branch information
nabdelgadir committed Dec 31, 2019
1 parent 729f37a commit ab075cc
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions docs/site/migration/datasources.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ datasources from LoopBack 3 to LoopBack 4 is simple.
In LoopBack 3, all datasources are defined in the `server/datasources.json`
file, whereas in LoopBack 4 each datasource is defined in its own file in the
`src/datasources` folder. Each LoopBack 4 datasource has a configuration file
(e.g. `db.datasource.config.ts`) and a class file (e.g. `db.datasource.ts`).
(e.g. `mysql-ds.datasource.config.ts`) and a class file (e.g.
`mysql-ds.datasource.ts`).

## Migration Steps

Expand All @@ -23,18 +24,18 @@ steps:

1. In the root of your LoopBack 4 application, use the `lb4 datasource` command
to create a new datasource and enter the same datasource name as your
LoopBack 3 application's datasource (e.g. `db`):
LoopBack 3 application's datasource (e.g. `mysqlDs`):

```
$ lb4 datasource
? Datasource name: db
? Datasource name: mysqlDs
```

2. For the remaining prompts from the `lb4 datasource` command, use the defaults
(press Enter for each one) since these will be replaced in the next step:

```
? Select the connector for db: In-memory db (supported by StrongLoop)
? Select the connector for mysqlDs: In-memory db (supported by StrongLoop)
? window.localStorage key to use for persistence (browser only):
? Full path to file for persistence (server only):
```
Expand All @@ -48,19 +49,29 @@ steps:

```json
{
"db": {
"name": "db",
"connector": "memory"
"mysqlDs": {
"name": "mysqlDs",
"connector": "mysql",
"host": "demo.strongloop.com",
"port": 3306,
"database": "getting_started",
"username": "demo",
"password": "L00pBack"
}
}
```

{% include code-caption.html content="src/datasources/db.datasource.config.json" %}
{% include code-caption.html content="src/datasources/mysql-ds.datasource.config.json" %}

```json
{
"name": "db",
"connector": "memory"
"name": "mysqlDs",
"connector": "mysql",
"host": "demo.strongloop.com",
"port": 3306,
"database": "getting_started",
"username": "demo",
"password": "L00pBack"
}
```

Expand Down

0 comments on commit ab075cc

Please sign in to comment.