Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

Commit

Permalink
17.4 and 17.5 complete
Browse files Browse the repository at this point in the history
  • Loading branch information
speudusa committed Nov 16, 2022
1 parent 5634c55 commit cdad1e2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/chapters/orm-intro/data-stores.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Our final refactored method looks like this:

Now that we are no longer using ``EventData``, we can delete it from our application. And as always, be sure to start your app and test after refactoring.

.. admonition::
.. admonition:: Tip

Remember that any time you update your database,
you need to add a migration to your project and update your database.
Expand Down
36 changes: 36 additions & 0 deletions src/chapters/orm-intro/exercises.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,42 @@ Adding a New Table to the Database
With the two steps completed above, you now need to add a new migration and update your database.
You should see a new table in your database!

.. admonition:: Tip

**Where is my table!?**

If you are not able to see your new ``EventCategory`` table try the following:

1. **Drop tables**

a. Start by dropping all of your tables in MySql Workbench

b. Add a new migration in your terminal

c. Update your database in the terminal

d. Refresh your schema in MySql Workbench

If you still can't see your table, then you will need to drop your schema and delete old migrations.

2. **Drop schema**

a. Drop the schema in MySql Workbench. Don't worry, we'll get it back.

b. Recreate your schema in MySql Workbench like you did earlier.
You can use the same names and passwords if you like. If you change any of the names and passwords, make sure you update your MySql connections that you made in the ``appsettings.json`` file as well as either you ``Program.cs`` or ``Startup.cs`` files.

c. Delete your old migrations from your C# project.

d. Add a new migration in your terminal

e. Update your database in the terminal

f. Refresh your schema in MySql Workbench

You should see your new table in MySql Workbench now.


The ``EventCategoryController`` Class
-------------------------------------

Expand Down

0 comments on commit cdad1e2

Please sign in to comment.