Skip to content

feat: async DDL execution#664

Merged
olavloite merged 1 commit intomainfrom
support-async-ddl
Jan 29, 2026
Merged

feat: async DDL execution#664
olavloite merged 1 commit intomainfrom
support-async-ddl

Conversation

@olavloite
Copy link
Collaborator

Adds support for async DDL execution. This can be used either by executing a raw set of DDL statements, or as an option for executing migrations. Executing async DDL means that it is only guaranteed that the execution of the DDL statements has successfully started when the method returns. It is not guaranteed that the DDL statements have finished executing.

This feature should only be used for DDL statements that create schema objects that the application does not (directly) need.

The feature can be used in any of the following ways:

await using var db = new MyDbContext(ConnectionString);
// This starts an asynchronous database migration, but does not wait for the DDL operation to finish.
// All pending migrations are started asynchronously.
await db.Database.StartMigrateAsync();

// This starts all pending migrations up to v1.2 asynchronously.
await db.Database.StartMigrateAsync("v1.2");

// This starts a batch of raw DDL statements.
await db.Database.StartDdlAsync([
  "create table my_table (id int64 primary key, value string(max))",
  "create index my_index on my_table (value)",
]);

@gemini-code-assist
Copy link

Summary of Changes

Hello @olavloite, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Google Cloud Spanner Entity Framework Core provider by introducing support for asynchronous DDL (Data Definition Language) execution. This feature allows developers to initiate database schema changes, such as migrations or custom DDL statements, and immediately regain control of their application without waiting for the potentially long-running DDL operations to complete. This is particularly beneficial for non-critical schema updates, like creating secondary indexes, where immediate consistency is not required, thereby improving application responsiveness and resource utilization.

Highlights

  • Asynchronous DDL Execution: Introduced new capabilities for executing Data Definition Language (DDL) operations asynchronously in Google Cloud Spanner for Entity Framework Core.
  • New Extension Methods: Added StartMigrateAsync and StartDdlAsync extension methods to DatabaseFacade, allowing migrations and raw DDL statements to be initiated without blocking for their completion.
  • Configurable DDL Execution Strategy: Implemented a new DdlExecutionStrategy enum with BlockUntilCompleted (default) and StartOperation options, providing control over how DDL operations are handled.
  • DbContext Configuration: Provided a UseMigrationDdlExecutionStrategy option for DbContextOptionsBuilder to configure the default DDL execution behavior for a DbContext.
  • Test Coverage: Included comprehensive test cases to validate the functionality of asynchronous migrations and DDL commands.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces asynchronous DDL execution capabilities, allowing DDL statements to be started without waiting for their completion. This is a valuable feature for scenarios where immediate DDL completion is not critical, such as creating secondary indexes. The changes include new extension methods for DatabaseFacade to start migrations and raw DDL statements asynchronously, along with an enum to configure the DDL execution strategy. Tests have been added to cover the new functionality. Overall, the implementation is well-structured and provides clear documentation for the new features.

Adds support for async DDL execution. This can be used either by executing a raw
set of DDL statements, or as an option for executing migrations. Executing async
DDL means that it is only guaranteed that the execution of the DDL statements has
successfully started when the method returns. It is not guaranteed that the DDL
statements have finished executing.

This feature should only be used for DDL statements that create schema objects
that the application does not (directly) need.

The feature can be used in any of the following ways:

```csharp
await using var db = new MyDbContext(ConnectionString);
// This starts an asynchronous database migration, but does not wait for the DDL operation to finish.
// All pending migrations are started asynchronously.
await db.Database.StartMigrateAsync();

// This starts all pending migrations up to v1.2 asynchronously.
await db.Database.StartMigrateAsync("v1.2");

// This starts a batch of raw DDL statements.
await db.Database.StartDdlAsync([
  "create table my_table (id int64 primary key, value string(max))",
  "create index my_index on my_table (value)",
]);
```
Copy link
Collaborator

@bhatt4982 bhatt4982 left a comment

Choose a reason for hiding this comment

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

LGTM...

@olavloite olavloite merged commit 03598af into main Jan 29, 2026
17 of 25 checks passed
@olavloite olavloite deleted the support-async-ddl branch January 29, 2026 14:49
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.

2 participants