Skip to content

Commit 471da58

Browse files
authored
Merge pull request #36 from mongodb-developer/add-pre-migration-analysis
Add pre migration analysis
2 parents 5c26a25 + 63f2b94 commit 471da58

35 files changed

+122
-41
lines changed

docs/0-intro.mdx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
---
2-
sidebar_position: 10
2+
sidebar_position: 01
33
---
44
# 📘 Introduction
55

6-
import Tabs from '@theme/Tabs';
7-
import TabItem from '@theme/TabItem';
8-
96
|Workshop goals|Migrate a relational DB into MongoDB Atlas|
107
|-|-|
11-
|What you'll learn|- What is the [MongoDB Relational Migrator](https://www.mongodb.com/products/tools/relational-migrator)?|
12-
||- How to install it|
13-
||- Importing a relational DB: import the schema|
14-
||- Map the relational schema to a MongoDB schema|
15-
||- Migrate the data to MongoDB|
8+
|What you'll learn| What is the [MongoDB Relational Migrator](https://www.mongodb.com/products/tools/relational-migrator)?|
9+
|| How to run a pre-migration analysis |
10+
|| How to import the relational schema|
11+
|| Add mapping rules to convert the relational schema to a MongoDB schema|
12+
|| How to convert your SQL queries and stored procedures |
13+
|| How to migrate the data to MongoDB|
1614
|Prerequisites| See [Dev Environment](/docs/category/dev-environment/)|
1715
|Time to complete|1.5 hour|
1816

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
sidebar_position: 05
3+
---
4+
import Screenshot from "@site/src/components/Screenshot";
5+
6+
# 📘 What is the MongoDB Relational Migrator
7+
8+
The [Relational Migrator](https://www.mongodb.com/products/tools/relational-migrator) is a free tool that streamlines migrating data from RDBMS to MongoDB, significantly lowering the effort and risk of a migration initiative.

docs/10-dev-env/1-dev-env-setup.mdx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ Let it run for a few minutes as it prepares a Docker container with all the requ
2121

2222
<details>
2323
<summary>🦹 __Run this lab locally__</summary>
24+
25+
:::info
26+
Again: during the lab, we will use GitHub Codespaces. The following instructions are here just in case you can't use Codespaces or if you really, really, really want to try a local installation.
27+
:::
28+
2429
#
2530
# 1. MongoDB Database
2631

@@ -62,19 +67,17 @@ Let it run for a few minutes as it prepares a Docker container with all the requ
6267

6368
Download and install MongoDB Relational Migrator.
6469

65-
- Go to the [MongoDB Relational Migrator downloads page](https://www.mongodb.com/try/download/relational-migrator), select your OS and download it
66-
- Install the MongoDB Relational Migrator
67-
- Start it
70+
- Open the [MongoDB Relational Migrator downloads page](https://www.mongodb.com/try/download/relational-migrator)
71+
- Select your platform (OS / Architecture if applies) and download it.
72+
- Install the MongoDB Relational Migrator.
73+
- Launch it.
6874
- It should open a browser at the address http://127.0.0.1:8278/
75+
- You should see an icon to launch/quit the Relational Migrator.
6976

70-
<Screenshot url="https://www.mongodb.com/products/tools/relational-migrator" src="img/download-relational-migrator.png" alt="Screenshot of the download page for Relational Migrator" />
77+
<Screenshot url="https://www.mongodb.com/try/download/relational-migrator" src="img/download-relational-migrator.png" alt="Screenshot of the download page for Relational Migrator" />
7178

7279
---
7380

74-
There are more advanced ways to install the MongoDB Relational Migrator. You can check them out in [the installation docs page](https://www.mongodb.com/docs/relational-migrator/installation/). These won't be covered during this Lab.
75-
76-
</details>
77-
78-
79-
81+
There are other, more advanced ways to install the MongoDB Relational Migrator. You can check them out in [the installation docs page](https://www.mongodb.com/docs/relational-migrator/installation/). These won't be covered during this Lab.
8082

83+
</details>

docs/10-dev-env/10-postgres.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ In this lab you will be migrating data from a PostgreSQL relational database.
1313
If you are participating in an instructor-led lab, they may have already set up this database for you. Ask your instructor for the connection URI and credentials.
1414

1515
:::caution
16-
In an intructor-led lab you will use the provisioned PostgreSQL database, no need to do anything else.
16+
In an intructor-led lab you will use the provisioned PostgreSQL database, no need to do anything else. The rest of the Lab assumes you have a PostgreSQL database running and accessible.
1717
:::
1818

1919
<details>

docs/30-schema-in-postgresql.mdx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import Screenshot from "@site/src/components/Screenshot";
22

33
# 📘 Schema in PostgreSQL
44

5-
The following screenshot shows an entity-relationship diagram of the relational database we wish to migrate. This is a library management app that stores information about books, where a book can have many authors, an author can write many books, and users can borrow books and leave reviews. You can have many copies of the same book and those are what users borrow and return. All this is registered in the `operations` collection. A library user can have many addresses.
6-
7-
This is the sample schema we use during our [Developer Days's Intro Lab](https://mongodb-developer.github.io/intro-lab/docs/importing-data/intro).
5+
The following screenshot shows an entity-relationship diagram of the relational database we wish to migrate. This is a library management app that stores information about books (table `books`), where a book can have many authors (table `authors`) and an author can write many books (`author_book` link table). Users can leave reviews (`reviews` table). You can have many copies of the same book. Users borrow and return books (this is registered in the `operations` table). A library user can have many addresses (`user_addresses` table).
86

97
[![Screenshot of the PostgreSQL ERD](/img/30-image-001.png)](/img/30-image-001.png)
10-
_Click to enlarge in a new tab / window_
8+
_Click to enlarge in a new tab / window_
9+
10+
:::info
11+
This is the sample schema we use during our [Developer Days's Intro Lab](https://mongodb-developer.github.io/intro-lab/docs/importing-data/intro).
12+
:::

docs/40-desired-schema-mongodb.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Screenshot from "@site/src/components/Screenshot";
44

55
Since MongoDB is a document database, you have more flexibility in how you model your data. When migrating from
66
a relational database to MongoDB, it's important to consider how your data is accessed, and model the data such
7-
that data that is frequently accessed together is stored together by using embedded documents and arrays.
7+
that __data that is frequently accessed together is stored together__ by using __embedded documents__ and __arrays__.
88

99
The following screenshot shows the MongoDB schema we will be creating in this lab.
1010

docs/50-create-project/50-create-new-project.mdx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
11
import Screenshot from "@site/src/components/Screenshot";
2+
import Tabs from '@theme/Tabs';
3+
import TabItem from '@theme/TabItem';
24

35
# 👐 Creating a New Project
46

5-
Ensure the Relational Migrator is installed and running (in your codespace or locally at http://127.0.0.1:8278/).
7+
Ensure the Relational Migrator is installed and running (either in your codespace or locally at http://127.0.0.1:8278/).
68

9+
## Create a New Project
710

8-
## Click on New Project
11+
<Tabs groupId="Create a New Project">
12+
<TabItem value="FirstTime" label="First Time using Relational Migrator">
913

14+
If you're running the Relational Migrator for the first time, you will see a welcome screen. We will `Start from scratch` and click on `Connect database`.
1015

11-
<Screenshot url="http://127.0.0.1:8278" src="img/50-image-001.png" alt="Screenshot of the connect modal" />
16+
<Screenshot url="http://127.0.0.1:8278" src="img/50-image-000.png" alt="Create a New Project clicking on Connect database" />
17+
18+
19+
</TabItem>
20+
<TabItem value="AlreadyUsed" label="I already have a project!">
21+
22+
Click on the `New Project` button in the top right corner of the Relational Migrator UI.
23+
24+
<Screenshot url="http://127.0.0.1:8278" src="img/50-image-001.png" alt="Create a New Project clicking on New Project" />
25+
26+
</TabItem>
27+
</Tabs>
1228

1329
## Select one of the three options
1430
- 👐 Click **Connect database** under "Connect to live database" if you are running the source database in the cloud, Docker or using your own hardware. This is what we will use during an instructor-led hands-on lab.

docs/50-create-project/60-connect-database.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Screenshot from "@site/src/components/Screenshot";
44

55
## Add a new connection
66

7-
We can store the credentials of our database so in the next session we can connect quickly. In this case, we'll create a new connection selecting "Add a new connection".
7+
We can store the credentials of our database so in the next session we can quickly re-connect. In this case, we'll create a new connection selecting "Add a new connection".
88

99
## Select PostgreSQL as Database Type
1010

@@ -16,15 +16,15 @@ Then we'll select PostgreSQL as our source database.
1616

1717
Enter the details for the PostgreSQL database you will be migrating from.
1818

19-
- It's important to click on the `SSL` tab and activate SSL (SSL mode Prefer is fine), otherwise we won't be able to connect to cloud hosted databases.
19+
- It's important to click on the `SSL` tab and activate `Use SSL` (`SSL mode` Prefer is fine), otherwise we won't be able to connect to cloud hosted databases.
2020
- If your instructors have configured a server for you to use, ask them for the host name, username and password.
21+
:::info
22+
👐 If you have followed the steps to configure PostgreSQL in Instruqt / GitHub Codespaces, the hostname will be `localhost`, username `postgres` and password `postgres`.
23+
:::
2124
- Click back on the `General` tab and enter the database name as `library`.
22-
- Click `Test Connection` to ensure your details are correct.
25+
- Check the `Save password` box if you want to save the password for future connections.
26+
- Click `Test Connection` to ensure your details are correct. You should see a message saying "PostgreSQL database connection successful."
2327
- Click `Connect` to proceed to the next step.
24-
- You can give your connection a name and a tag to make it simpler to remember later
28+
- You can give your connection a name and a tag to make it simpler to remember later.
2529

2630
<Screenshot url="http://127.0.0.1:8278" src="img/60-image-001.png" alt="Screenshot of the connect modal" />
27-
28-
:::info
29-
🦸‍♂️ If you have followed the steps to configure PostgreSQL in a docker container, the hostname will be `localhost`, username `postgres` and password `postgres`.
30-
:::

docs/50-create-project/80-define-initial-schema.mdx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@ import Screenshot from "@site/src/components/Screenshot";
22

33
# 👐 Define the Initial Schema
44

5-
Relational Migrator gives you three options on how your MongoDB schema should be created. Regardless of which option you choose, you can manually modify your schema later.
5+
Relational Migrator gives you three options on how your initial MongoDB schema will be created. Regardless of which option you choose, you can manually modify your schema later.
6+
7+
| Option | What it does |
8+
| :------------- | :---------- |
9+
| Start with a MongoDB schema that matches your relational schema | Maps each table exactly to one collection, including link tables (for 1:n relationships). We're just replicating the existing schema, which won't take advantage of the Document Model. |
10+
| Start with a recommended MongoDB schema | Will try to understand your schema and embed 1:n relationships. |
11+
| Start with an empty MongoDB schema | Your MongoDB schema will be empty. You'll create all the mappings yourself. |
612

713
Select `Start with a recommended MongoDB schema`
814

9-
You are asked which tables should represented as a collection in MongoDB.
15+
You can see which tables will be mapped to a collection in MongoDB: those marked as `TOP-LEVEL`.
1016

11-
Select the following six collections as they are the main entities in our schema:
17+
Select the following six collections as `TOP-LEVEL` since they are the main entities in our schema:
1218

1319
- authors
1420
- books
@@ -19,7 +25,7 @@ Select the following six collections as they are the main entities in our schema
1925

2026
Any tables you did not check will be embedded in other collections.
2127

22-
<Screenshot url="http://127.0.0.1:8278" src="img/80-image-001.png" alt="Screenshot of the connect modal" />
28+
<Screenshot url="http://127.0.0.1:8278" src="img/80-image-001.png" alt="Defining the initial schema" />
2329

2430
Select the casing you'd like for your collections - the default is camelCase.
2531

docs/50-create-project/_category_.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"label": "👐 Create a Project",
33
"link": {
44
"type": "generated-index",
5-
"description": "Create your Project in Relational Migrator."
5+
"description": "Create your Project in the MongoDB Relational Migrator and start with an initial schema."
66
}
77
}

0 commit comments

Comments
 (0)