Skip to content

Add Course entity and related migrations#20

Merged
JoeProgrammer88 merged 2 commits intomainfrom
Issue#5-CreateCourse
Oct 10, 2025
Merged

Add Course entity and related migrations#20
JoeProgrammer88 merged 2 commits intomainfrom
Issue#5-CreateCourse

Conversation

@JoeProgrammer88
Copy link
Copy Markdown
Member

Closes #5

This pull request introduces a new Course entity to the application and updates the database schema to support it. The changes include adding the Course model to the Entity Framework context, creating the necessary database tables via migrations, and enforcing a maximum length constraint on the course description field.

Entity and Database Schema Additions:

  • Added a DbSet<Course> property to the ApplicationDbContext class, enabling Entity Framework to track and manage Course entities.
  • Created an initial migration (20251010012840_AddedCourse) that adds the Courses table to the database, including columns for Id, Title, CourseCode, and Description. [1] [2]

Schema Constraint Update:

  • Added a follow-up migration (20251010013013_CourseDescriptionLength) to enforce a maximum length of 300 characters on the Description column in the Courses table.

Added a new `Course` entity with properties `Id`, `Title`,
`CourseCode`, and `Description`, including validation and
database constraints. Updated `ApplicationDbContext` to
include a `DbSet<Course>` and configured `ApplicationUser`
properties in `OnModelCreating`.

Created migration `20251010012840_AddedCourse` to add the
`Courses` table and migration `20251010013013_CourseDescriptionLength`
to limit the `Description` column to 300 characters. Updated
`ApplicationDbContextModelSnapshot` to reflect these changes.
Added XML documentation for the `Course` class.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new Course entity to support course management functionality in the application. The changes add the Course model with proper validation constraints, create the necessary database tables through Entity Framework migrations, and integrate the entity into the application's data context.

  • Added a Course entity with proper data annotations for validation and constraints
  • Created two database migrations to establish the Courses table and enforce description length limits
  • Updated the ApplicationDbContext to include the Course entity and modernized namespace syntax

Reviewed Changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
SpeakingInBitsWeb/Models/Course.cs Defines the Course entity with validation attributes and documentation
SpeakingInBitsWeb/Data/ApplicationDbContext.cs Adds Course DbSet and updates namespace to file-scoped
SpeakingInBitsWeb/Data/Migrations/20251010012840_AddedCourse.cs Initial migration creating the Courses table
SpeakingInBitsWeb/Data/Migrations/20251010013013_CourseDescriptionLength.cs Follow-up migration adding 300-character limit to Description column
SpeakingInBitsWeb/Data/Migrations/ApplicationDbContextModelSnapshot.cs Updated model snapshot reflecting the Course entity configuration
Files not reviewed (2)
  • SpeakingInBitsWeb/Data/Migrations/20251010012840_AddedCourse.Designer.cs: Language not supported
  • SpeakingInBitsWeb/Data/Migrations/20251010013013_CourseDescriptionLength.Designer.cs: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread SpeakingInBitsWeb/Models/Course.cs Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@JoeProgrammer88 JoeProgrammer88 merged commit 96c9b06 into main Oct 10, 2025
1 check passed
@JoeProgrammer88 JoeProgrammer88 deleted the Issue#5-CreateCourse branch October 10, 2025 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a course class and add to the existing database context class

2 participants