Skip to content

Commit

Permalink
📚 - Updating README for Data solution
Browse files Browse the repository at this point in the history
  • Loading branch information
sachpatel committed Jul 9, 2018
1 parent dfafb86 commit 4c7c1c1
Showing 1 changed file with 37 additions and 12 deletions.
49 changes: 37 additions & 12 deletions src/Data/README.md
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">&nbsp;</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.

&nbsp;

# 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.

&nbsp;

# 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).

0 comments on commit 4c7c1c1

Please sign in to comment.