private void FindCreatedTables( Tuple <IModel, IModel> modelPair, IEnumerable <Tuple <IEntityType, IEntityType> > tablePairs) { var tables = modelPair.Item2.EntityTypes .Except(tablePairs.Select(p => p.Item2)) .ToList(); _operations.AddRange( tables.Select(t => OperationFactory.CreateTableOperation(t))); // TODO: GitHub#1107 _operations.AddRange(_operations.Get <CreateTableOperation>() .SelectMany(o => o.ForeignKeys)); _operations.AddRange(_operations.Get <CreateTableOperation>() .SelectMany(o => o.Indexes)); }
public virtual IReadOnlyList <MigrationOperation> CreateSchema([NotNull] IModel model) { Check.NotNull(model, "model"); _operations = new MigrationOperationCollection(); _operations.AddRange(GetSequences(model) .Select(s => OperationFactory.CreateSequenceOperation(s))); _operations.AddRange(model.EntityTypes .Select(t => OperationFactory.CreateTableOperation(t))); // TODO: GitHub#1107 _operations.AddRange(_operations.Get <CreateTableOperation>() .SelectMany(o => o.ForeignKeys)); _operations.AddRange(_operations.Get <CreateTableOperation>() .SelectMany(o => o.Indexes)); return(OperationProcessor.Process(_operations, new Metadata.Model(), model)); }