public async Task <Table> ExistingTableFor(Type type) { var mapping = _features.MappingFor(type).As <DocumentMapping>(); var expected = mapping.Schema.Table; await using var conn = CreateConnection(); await conn.OpenAsync().ConfigureAwait(false); return(await expected.FetchExisting(conn).ConfigureAwait(false)); }
public async Task <SchemaMigration> CreateMigrationAsync(Type documentType) { var mapping = _features.MappingFor(documentType); using var conn = _tenant.CreateConnection(); await conn.OpenAsync(); var migration = await SchemaMigration.Determine(conn, mapping.Schema.Objects); return(migration); }
public SchemaPatch ToPatch(Type documentType) { var mapping = _features.MappingFor(documentType); var patch = new SchemaPatch(StoreOptions.DdlRules); using (var conn = _tenant.CreateConnection()) { conn.Open(); patch.Apply(conn, AutoCreate.CreateOrUpdate, mapping.As <IFeatureSchema>().Objects); } return(patch); }