Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 1, 2025

Implementation Complete - Persistence Documentation (PR 3)

✅ All Requirements Met

New Documentation Created:

  • guides/persistence/sql-server.md (472 lines) - Complete SQL Server setup guide

  • guides/persistence/ef-migrations.md (661 lines) - Complete EF Core migrations guide

    • ✅ Elsa's DbContext architecture explained (ManagementElsaDbContext, RuntimeElsaDbContext)
    • ✅ Adding custom entities with full code examples
    • ✅ Migration commands reference (dotnet ef)
    • ✅ Three migration strategies (single DB, separate DBs, split management/runtime)
    • ✅ Version upgrade guidance and rollback procedures
    • ✅ Troubleshooting section
    • Addresses: Issue Generating Custom EF Core Migrations #74, references elsa-core #6355

Navigation & Cross-linking:

  • Updated SUMMARY.md with new guide links
  • Enhanced guides/persistence/README.md with links to new guides
  • Added cross-references in getting-started/database-configuration.md
  • Added "See Also" section in persistent-database.md
  • Added persistence links in docker-quickstart.md

Quality Validation:

  • All code snippets validated against Elsa v3 APIs
  • Markdown style consistent with existing documentation
  • All internal links verified to exist
  • Code review feedback addressed
  • Security issues resolved (TrustServerCertificate → Encrypt, missing using directives)

Issues Addressed:

Original prompt

Implement "PR 3" from our prior planning for elsa-workflows/elsa-gitbook.

Goal: Introduce a clear, user-focused persistence documentation set covering supported providers (SQL Server, PostgreSQL, MongoDB, etc.) and how to configure EF Core migrations for Elsa. This should directly address:

Repository: elsa-workflows/elsa-gitbook
Base branch: main

Requirements:

  1. Add a persistence providers overview

    • New file: guides/persistence/README.md.
    • Content:
      • Explain what Elsa persists (workflow definitions, workflow instances, bookmarks, logs/metadata) in general terms.
      • List the supported persistence providers at a high level (based on elsa-core and elsa-extensions):
        • EF Core with relational databases (SQL Server, PostgreSQL, etc.).
        • MongoDB, if supported for v3 (verify in elsa-core/elsa-extensions).
        • Any other major providers that are clearly available.
      • Describe how Workflow Runtime and Workflow Management modules each use persistence and that they must be configured consistently.
      • Provide links (within this guide) to provider-specific sub-guides (e.g., sql-server.md, postgresql.md, mongo.md) and the EF migrations guide.
  2. Add a SQL Server-specific guide (explicitly addressing [DOC] How to use SQLServer instead of SqlLite in Els3.0? #2)

    • New file: guides/persistence/sql-server.md.
    • Content:
      • Requirements:
        • Which NuGet packages are needed (e.g., Microsoft.EntityFrameworkCore.SqlServer).
        • Which Elsa modules rely on EF Core (runtime & management) and need config.
      • Concrete configuration example:
        • Show a Program.cs snippet using the current Elsa v3 API to switch from SQLite to SQL Server, including both Workflow Runtime and Workflow Management modules.
        • Example should use UseEntityFrameworkCore and UseSqlServer (or equivalent) in the right places.
        • Pull exact method names and patterns from the current elsa-core repo (e.g., from the main server sample and/or module extensions).
      • Clarify how connection strings are typically provided (e.g., configuration.GetConnectionString("Elsa")).
      • Briefly note migration behavior: that Elsa ships with default EF migrations, but that users can also add custom migrations (and link to the EF migrations guide from requirement 3).
  3. Add an EF Core migrations guide (addresses Generating Custom EF Core Migrations #74)

    • New file: guides/persistence/ef-migrations.md.
    • Content:
      • Explain how Elsa uses EF Core migrations by default (what tables it creates, at a high level; no full schema needed).
      • Show how to:
        • Reference Elsa's DbContexts from a host project (identify the context types from elsa-core and show how to point dotnet ef at them).
        • Add your own entities into the same database and generate combined migrations.
        • Run dotnet ef migrations add and dotnet ef database update against the host project.
      • Discuss strategies:
        • Single database shared with app vs dedicated Elsa persistence database.
        • Keeping Elsa migrations separate from custom migrations (e.g., separate contexts/projects) if desired.
      • Include concrete commands and a minimal csproj/Program.cs example that will work with the current Elsa 3.x setup in elsa-core.
      • Reference elsa-core issue 6355 in a short "For maintainers" note so the history is visible.
  4. Wire these guides into navigation

    • Update SUMMARY.md to add a new "Persistence" section under an appropriate place (e.g., after Core Concepts or Setup/Guides):
      • Link to:
        • guides/persistence/README.md (e.g., "Persistence Providers")
        • guides/persistence/sql-server.md (e.g., "SQL Server")
        • guides/persistence/ef-migrations.md (e.g., "EF Core migrations")
    • Ensure the section title and ordering are consistent with the existing structure.
  5. Cross-link from related pages

    • On any existing getting-started or storage/setup page that currently mentions SQLite or persistence in passing (for example, the basic server setup guide), add a short "See also" link pointing to the persistence overview (guides/persistence/README.md).
    • If the quick SQL Server pointer added in PR 1 exists (e.g., a small subsection in a setup doc), refactor it to:
      • Either delegate to guides/persistence/sql-server.md to avoid duplication, or
      • Be consistent with the new guide (same API names and snippet style).
  6. Consistency and scope

    • Match the existing Markdown style in elsa-gitbook (headings, admonitions, code fences, etc.).
    • Do not attempt to fully solve k8s deployment or onboarding gaps here; limit this PR to persistence configuration and migrations.
    • Validate all code snippets a...

This pull request was created as a result of the following prompt from Copilot chat.

Implement "PR 3" from our prior planning for elsa-workflows/elsa-gitbook.

Goal: Introduce a clear, user-focused persistence documentation set covering supported providers (SQL Server, PostgreSQL, MongoDB, etc.) and how to configure EF Core migrations for Elsa. This should directly address:

Repository: elsa-workflows/elsa-gitbook
Base branch: main

Requirements:

  1. Add a persistence providers overview

    • New file: guides/persistence/README.md.
    • Content:
      • Explain what Elsa persists (workflow definitions, workflow instances, bookmarks, logs/metadata) in general terms.
      • List the supported persistence providers at a high level (based on elsa-core and elsa-extensions):
        • EF Core with relational databases (SQL Server, PostgreSQL, etc.).
        • MongoDB, if supported for v3 (verify in elsa-core/elsa-extensions).
        • Any other major providers that are clearly available.
      • Describe how Workflow Runtime and Workflow Management modules each use persistence and that they must be configured consistently.
      • Provide links (within this guide) to provider-specific sub-guides (e.g., sql-server.md, postgresql.md, mongo.md) and the EF migrations guide.
  2. Add a SQL Server-specific guide (explicitly addressing [DOC] How to use SQLServer instead of SqlLite in Els3.0? #2)

    • New file: guides/persistence/sql-server.md.
    • Content:
      • Requirements:
        • Which NuGet packages are needed (e.g., Microsoft.EntityFrameworkCore.SqlServer).
        • Which Elsa modules rely on EF Core (runtime & management) and need config.
      • Concrete configuration example:
        • Show a Program.cs snippet using the current Elsa v3 API to switch from SQLite to SQL Server, including both Workflow Runtime and Workflow Management modules.
        • Example should use UseEntityFrameworkCore and UseSqlServer (or equivalent) in the right places.
        • Pull exact method names and patterns from the current elsa-core repo (e.g., from the main server sample and/or module extensions).
      • Clarify how connection strings are typically provided (e.g., configuration.GetConnectionString("Elsa")).
      • Briefly note migration behavior: that Elsa ships with default EF migrations, but that users can also add custom migrations (and link to the EF migrations guide from requirement 3).
  3. Add an EF Core migrations guide (addresses Generating Custom EF Core Migrations #74)

    • New file: guides/persistence/ef-migrations.md.
    • Content:
      • Explain how Elsa uses EF Core migrations by default (what tables it creates, at a high level; no full schema needed).
      • Show how to:
        • Reference Elsa's DbContexts from a host project (identify the context types from elsa-core and show how to point dotnet ef at them).
        • Add your own entities into the same database and generate combined migrations.
        • Run dotnet ef migrations add and dotnet ef database update against the host project.
      • Discuss strategies:
        • Single database shared with app vs dedicated Elsa persistence database.
        • Keeping Elsa migrations separate from custom migrations (e.g., separate contexts/projects) if desired.
      • Include concrete commands and a minimal csproj/Program.cs example that will work with the current Elsa 3.x setup in elsa-core.
      • Reference elsa-core issue 6355 in a short "For maintainers" note so the history is visible.
  4. Wire these guides into navigation

    • Update SUMMARY.md to add a new "Persistence" section under an appropriate place (e.g., after Core Concepts or Setup/Guides):
      • Link to:
        • guides/persistence/README.md (e.g., "Persistence Providers")
        • guides/persistence/sql-server.md (e.g., "SQL Server")
        • guides/persistence/ef-migrations.md (e.g., "EF Core migrations")
    • Ensure the section title and ordering are consistent with the existing structure.
  5. Cross-link from related pages

    • On any existing getting-started or storage/setup page that currently mentions SQLite or persistence in passing (for example, the basic server setup guide), add a short "See also" link pointing to the persistence overview (guides/persistence/README.md).
    • If the quick SQL Server pointer added in PR 1 exists (e.g., a small subsection in a setup doc), refactor it to:
      • Either delegate to guides/persistence/sql-server.md to avoid duplication, or
      • Be consistent with the new guide (same API names and snippet style).
  6. Consistency and scope

    • Match the existing Markdown style in elsa-gitbook (headings, admonitions, code fences, etc.).
    • Do not attempt to fully solve k8s deployment or onboarding gaps here; limit this PR to persistence configuration and migrations.
    • Validate all code snippets against the latest elsa-core APIs (especially the AddElsa configuration for runtime and management modules).

Deliverables:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add persistence documentation for supported providers Add SQL Server and EF Core migrations guides for persistence configuration Dec 1, 2025
Copilot AI requested a review from sfmskywalker December 1, 2025 20:34
@sfmskywalker sfmskywalker marked this pull request as ready for review December 1, 2025 20:36
Copilot AI review requested due to automatic review settings December 1, 2025 20:36
Copy link
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 pull request adds comprehensive documentation for SQL Server persistence and Entity Framework Core migrations in Elsa Workflows v3, directly addressing user confusion around database configuration and custom migration workflows. The PR fulfills its goal of providing clear, provider-specific guidance while maintaining consistency with existing documentation patterns.

Key Changes

  • New SQL Server Guide: Complete 472-line guide covering NuGet packages, configuration, connection strings, migration deployment, troubleshooting, and production considerations
  • New EF Core Migrations Guide: Comprehensive 661-line guide explaining Elsa's DbContext architecture, custom entity integration patterns, migration strategies, and version upgrade workflows
  • Enhanced Navigation: Added persistence guides to SUMMARY.md and cross-linked from database configuration and Docker guides

Reviewed changes

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

Show a summary per file
File Description
guides/persistence/sql-server.md Comprehensive SQL Server setup guide with configuration examples, troubleshooting, and production best practices (addresses #2, #11)
guides/persistence/ef-migrations.md Detailed EF Core migrations guide covering custom entities, DbContext patterns, and migration strategies (addresses #74, references elsa-core #6355)
guides/persistence/README.md Updated with cross-links to new SQL Server and EF Core Migrations guides
getting-started/database-configuration.md Enhanced with references to new comprehensive persistence guides
getting-started/containers/docker-compose/persistent-database.md Added "See Also" section with links to database and persistence documentation
getting-started/containers/docker-compose/docker-quickstart.md Added cross-references to database configuration and persistence guides
SUMMARY.md Added SQL Server and EF Core Migrations entries under Persistence section

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@sfmskywalker
Copy link
Member

@copilot apply changes based on the comments in this thread

- Add missing using directive for SqlConnectionStringBuilder
- Replace TrustServerCertificate with Encrypt in environment examples

Co-authored-by: sfmskywalker <[email protected]>
Copy link
Contributor Author

Copilot AI commented Dec 2, 2025

@copilot apply changes based on the comments in this thread

All changes from the review thread have already been applied in commit 63751c6:

  • Added using Microsoft.Data.SqlClient; directive to the SqlConnectionStringBuilder example
  • Updated environment variable examples to use Encrypt=true instead of TrustServerCertificate=true

@sfmskywalker sfmskywalker merged commit da71322 into main Dec 2, 2025
5 checks passed
@sfmskywalker sfmskywalker deleted the copilot/add-persistence-documentation branch December 2, 2025 18:25
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.

Generating Custom EF Core Migrations Configuring Persistence Providers for Workflow Runtime and Management

2 participants