-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📚 - Updating README for Data solution
- Loading branch information
Showing
1 changed file
with
37 additions
and
12 deletions.
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,45 +1,70 @@ | ||
# :leaves: Seed Data Writer Tool :rocket: # | ||
# Table of Contents | ||
* [Data Seeder Tool](#user-content-seedDataWriterTool) | ||
* [Writing Change Migration Scripts](#user-content-authoringChangeMigrationScripts) | ||
* [Running Change Migration Scripts](#user-content-runningChangeMigrationScripts) | ||
|
||
## Introduction ## | ||
| ||
|
||
# :leaves: Seed Data Writer Tool :rocket: <a name="seedDataWriterTool"> </a> | ||
|
||
## Introduction | ||
|
||
This output of the `Console.RecruitSeedDataWriter` project can be used to load initial data into the Recruit document database used by the following applications: | ||
- Employer Recruit | ||
- QA Recruit | ||
- Provider Recruit (TBC) | ||
- Vacancy API 1.0 (TBC) | ||
|
||
## Project Setup ## | ||
## Project Setup | ||
|
||
The basic principle behind this repository is to store a copy of the reference data that needs to be loaded into the Recruit database (any other document database can be targetted). | ||
|
||
## Prerequisites ## | ||
## Prerequisites | ||
|
||
- DotNet Core | ||
- A target document database created in MongoDB :leaves: or Azure CosmosDB :rocket:. | ||
|
||
## Running Locally ## | ||
## Running Locally | ||
|
||
The project can be opened within Visual Studio or VS Code. Once built, from the folder containing the built binaries `/bin/{Configuration}/netcoreapp2.0/` you can run the tool in the following two ways: | ||
1. `./SeedScript.ps1 -$dbConnectionString {DatabaseConnectionStringUrl}` from a Powershell prompt. Will attempt to load all existing data document scripts specified inside `SeedScript.ps1` into the target database. | ||
2. `dotnet Console.RecruitSeedDataWriter.dll {DatabaseConnectionStringUrl} -c {collectionName} -f {jsonFilePath}` to load a single document into a target collection. | ||
|
||
## Deployment ## | ||
## Deployment | ||
|
||
The project can be published by running `dotnet publish` in the project directory. | ||
|
||
| ||
|
||
# Running migration scripts locally in Mongo shell :leaves: :shell: | ||
# Writing change migration scripts :leaves: :scroll: <a name="authoringChangeMigrationScripts"></a> | ||
|
||
## Prerequisites ## | ||
## Prerequisites | ||
|
||
- Mongo shell (Pointing at your target database server.) | ||
- A target document database created in MongoDB :leaves: or Azure CosmosDB :rocket:. | ||
- Mongo shell (Pointing at your target database server.) | ||
- NodeJS 6.0+ (Optional) | ||
- ESLint (Optionally already installed globally) | ||
|
||
## Instructions | ||
|
||
## Instructions ## | ||
1. Create new script following the convention used for existing files which are number ordered by prefixing the filename with a three digit sequence e.g. 010. | ||
2. Add a call to the new script from the `documentMigration.js` file by adding a `load("{filename.js}");` line. | ||
|
||
1. From the Mongo shell you can navigate to the directory that holds the `databaseMigration.js` and child scripts using `cd("../../../dev/das-recruit/src/data/CosmosDb")` assuming you have cloned the repository into the dev folder of your root dir. You can use `pwd()` to print your working directory to help you navigate. | ||
**If you do not have ESLint installed globally, then run the following step in a command shell, otherwise skip to step 4.** | ||
3. From the CosmosDb directory in a command shell, run `npm install`. If you do not already have ESLint installed globally. | ||
4. In a command shell in the same directory, run `npm run lint` to check the script-Java is written in a standard format. | ||
|
||
| ||
|
||
# Running change migration scripts locally in Mongo shell :leaves: :shell: <a name="runningChangeMigrationScripts"></a> | ||
|
||
## Prerequisites | ||
|
||
- A target document database created in MongoDB :leaves: or Azure CosmosDB :rocket:. | ||
- Mongo shell (Pointing at your target database server.) | ||
|
||
## Instructions | ||
|
||
1. From the Mongo shell you can navigate to the directory that holds the `databaseMigration.js` and child scripts using `cd("../../../dev/das-recruit/src/data/CosmosDb")` assuming you have cloned the repository into the dev folder of your root dir. You can use `pwd()` to print your working directory to help you navigate. | ||
2. Enter the command `load("documentMigration.js")` and press `Enter` | ||
3. You should see output relating to the changes included in the migration script. | ||
3. You should see output relating to the changes included in the change migration script(s). |