| 1 | using AgentForge.Abstractions; |
| 2 | using AgentForge.Data; |
| 3 | using Microsoft.EntityFrameworkCore; |
| 4 | |
| 5 | namespace AgentForge.Plugins; |
| 6 | |
| 7 | public sealed class ForgeMigrationContext(ForgeDbContext db) : IForgeMigrationContext |
| 8 | { |
| 9 | public bool TableExists(string table) => ForgeSchemaProbe.TableExists(db, table); |
| 10 | |
| 11 | public void TryAddColumn(string table, string column, string definition) => |
| 12 | ForgeSchemaProbe.TryAddColumn(db, table, column, definition); |
| 13 | |
| 14 | public void ExecuteSql(string sql) |
| 15 | { |
| 16 | #pragma warning disable EF1002 |
| 17 | db.Database.ExecuteSqlRaw(sql); |
| 18 | #pragma warning restore EF1002 |
| 19 | } |
| 20 | |
| 21 | public void ApplyPendingMigrations() => db.Database.Migrate(); |
| 22 | } |
| 23 | |
View only · write via MCP/CIDE