## DWS Migration Notes

- DWS does not have folder card data so we do not need to run `migrate_folderdata.py`
- Before running `migrate_filedata.py`
    # checks in {}config.json
    - Run the SQL Query `Find_Duplicate_Rows.sql`. This will show us everywhere there are conflicts in the Document Configurations.
      This will show us all the ConfigID's we have to worry about manually mapping in the `config.json`
    - Confirm Root Folder = DWS
- Run `migrate_filedata.py`

## After Migration

# 1. State Transitions
- Compile CSV lists for the state mappings. Look at the Existing DWS.CSV files for reference.
- Add the Admin-Transitions to the Drilling Vault production environment so that we can move files directly.
- We don't need to do anything for WIP, parts that come in as WIP as default
- Schema
    VAULTED -> VAULTED
    RELEASED -> APPROVED
    CHANGE PENDING APPROVAL -> CHANGE PENDING APPROVAL
- Run the PDM Transitions using `\config\batch_workflows_paths.py`
    - EX: **python batch_workflows_paths.py -v {Vault Name} -c {Filename.csv} -t {Transition Name}**

# 2. Variable Copying
DWS wants to use the existing filecards. The problem is that the Existing filecards use the variable **Drawing Number**. DWS used the variable **Number**
We can handle this by simply making a copy of the existing data in the `VariableValue` table in SQL. It isn't linked in a complicated web so adding rows doesnt hurt it

EX:
    VariableID	DocumentID	ProjectID	RevisionNo	ConfigurationID	ValueText	ValueInt	ValueFloat	ValueDate	ValueCache	IsLongText
          45	24499	       2	        1	          82	      SWR	      NULL	       NULL	1900-01-01 00:00:00.000	SWR	0

**We would just insert this row (only change is VariableID)**

    VariableID	DocumentID	ProjectID	RevisionNo	ConfigurationID	ValueText	ValueInt	ValueFloat	ValueDate	ValueCache	IsLongText
          75	24499	       2	        1	          82	      SWR	      NULL	       NULL	1900-01-01 00:00:00.000	SWR	0

- use the python file `/helpers/db_helper.py`
## Note the VariableID's in here are for the Test DB.
## UDPATE VARIABLE VALUES WITH THE PRODUCTION VALUES
- First run it with the parameter `python db_helper.py --db target_db --task check_vv50`
- Once that is complete there should be a csv file `has_vv50_{date}.txt` that shows anything that already has a variable value for **Drawing Number**
- If that looks good run `python db_helper.py --db target_db --task copy_57_to_50 --dry-run` if you want to run dry-run



