<commit_before># loopback-migration-tool

loopback-migration-tool expose the `lb-migration` script that ables you easy
handle migrations and seeders for Loopback.io

## Usage

### Install Global

Install with Yarn
```
yarn global add loopback-migration-tool
```
or install with NPM
```
npm i -g loopback-migration-tool
```
Migrate all your models on all datasources.
```
lb-migration migrate
```
Migrate all your models on specific datasources.
```
lb-migration migrate --ds=datasource1 datasource2
```
Migrate specific models on specific datasources.
```
lb-migration migrate --ds=datasource1 datasource2 --model=model1 model2 model3
```
Migrate specific models using autoupdate method.
```
lb-migration migrate --model=model1 model2 model3 --method=update
```
Seed your models with files in `./seeds/*.js`.
```
lb-migration seed
```
Seed your models with files in multiple locations.
```
lb-migration seed --src=path/to/files1/*.js path/to/files2/*.js path/to/files3/*.js  
```

### Install as dev dependency

Install with Yarn
```
yarn add loopback-migration-tool --dev
```
or install with NPM
```
npm i loopback-migration-tool --save-dev
```
In your project root.
```
node_modules/.bin/lb-migration migrate [options] 
```

## options

### .lb-migrationrc.*

You can use a `.lb-migrationrc.json` or `.lb-migrationrc.js` to save your common migration settings.

### Global options

| Property 	|                  Description                  	|  Type  	| Values 	|        Default       	|           As argument                                         |
|:--------:	|:---------------------------------------------:	|:------:	|:------:	|:--------------------:	|:------------------------------------------------------------:	|
|    app   	| Path to your loopback application</br>main file. 	| String 	|        	| *./server/server.js* 	| -a=*value* </br> --app=*value* </br> --loopback-app=*value* 	|

### migrate

| Property 	|                                                                                                       Description                                                                                                                     	|       Type       	|     Values     	| Default 	|               As argument     	|
|:--------:	|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:	|:----------------:	|:--------------:	|:-------:	|:-----------------------------:	|
|    ds    	|Datasources that will be migrated.</br>If empty or not present, all datasources will be migrates.                                                                                                                          	            | String, [String] 	|                	|    []   	| -d </br> --ds </br> --datasource 	|
|   model  	|Models in the selected datasources</br>that will be migrated. If empty or not present,</br>all models in all selected datasources will</br>be migrates. Selected Models not presents in</br>selected datasources will be not migrated. 	|     [String]     	|                	|    []   	|        --mod </br> --model    	|
|  method  	|Loopback migration method to use.</br>Loopback uses automigrate and autoupdate methods</br>for migrations.                                                                                                                     	        |      String      	| update migrate 	| migrate 	|           -m </br> --method     	|



<commit_msg>Add warnings<commit_after># loopback-migration-tool

loopback-migration-tool expose the `lb-migration` script that ables you easy
handle migrations and seeders for Loopback.io

## Usage

### Install Global

Install with Yarn
```
yarn global add loopback-migration-tool
```
or install with NPM
```
npm i -g loopback-migration-tool
```
Migrate all your models on all datasources.
```
lb-migration migrate
```
Migrate all your models on specific datasources.
```
lb-migration migrate --ds=datasource1 datasource2
```
Migrate specific models on specific datasources.
```
lb-migration migrate --ds=datasource1 datasource2 --model=model1 model2 model3
```
Migrate specific models using autoupdate method.
```
lb-migration migrate --model=model1 model2 model3 --method=update
```
Seed your models with files in `./seeds/*.js`.
```
lb-migration seed
```
Seed your models with files in multiple locations.
```
lb-migration seed --src=path/to/files1/*.js path/to/files2/*.js path/to/files3/*.js  
```

### Install as dev dependency

Install with Yarn
```
yarn add loopback-migration-tool --dev
```
or install with NPM
```
npm i loopback-migration-tool --save-dev
```
In your project root.
```
node_modules/.bin/lb-migration migrate [options] 
```

## options

### .lb-migrationrc.*

You can use a `.lb-migrationrc.json` or `.lb-migrationrc.js` to save your common migration settings.

### Global options

| Property 	|                  Description                  	|  Type  	| Values 	|        Default       	|           As argument                                         |
|:--------:	|:---------------------------------------------:	|:------:	|:------:	|:--------------------:	|:------------------------------------------------------------:	|
|    app   	| Path to your loopback application</br>main file. 	| String 	|        	| *./server/server.js* 	| -a=*value* </br> --app=*value* </br> --loopback-app=*value* 	|

### migrate

**Important:** Loopback's datasources uses two methods to migrate your models. 

- **Auto-migration:** Drop existing schema objects if they exist, and re-create them based on model definitions. Existing data will be lost.
- **Auto-update:** Detect the difference between schema objects and model definitions, and alter the database schema objects. Keep existing data.
 
 **Be careful what method must you use.**

| Property 	|                                                                                                       Description                                                                                                                     	|       Type       	|     Values     	| Default 	|               As argument     	|
|:--------:	|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:	|:----------------:	|:--------------:	|:-------:	|:-----------------------------:	|
|    ds    	|Datasources that will be migrated.</br>If empty or not present, all datasources will be migrates.                                                                                                                          	            | String, [String] 	|                	|    []   	| -d </br> --ds </br> --datasource 	|
|   model  	|Models in the selected datasources</br>that will be migrated. If empty or not present,</br>all models in all selected datasources will</br>be migrates. Selected Models not presents in</br>selected datasources will be not migrated. 	|     [String]     	|                	|    []   	|        --mod </br> --model    	|
|  method  	|Loopback migration method to use.</br>Loopback uses automigrate and autoupdate methods</br>for migrations.                                                                                                                     	        |      String      	| update migrate 	| migrate 	|           -m </br> --method     	|


### migrate

**Important:** `seed` command will destroy all existing data in selected models before start to seed them.  


{'fraction_non_alphanumeric': 0.21580863234529382, 'fraction_numerical': 0.0033801352054082163, 'mean_word_length': 1.2330914368650219, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 50, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '548509', 'n_tokens_mistral': 1951, 'n_tokens_neox': 1828, 'n_words': 574}