Exemplo n.º 1
0
 private void FindCreatedSequences(IEnumerable <Tuple <ISequence, ISequence> > sequencePairs, IEnumerable <ISequence> targetSequences)
 {
     _operations.AddRange(
         targetSequences
         .Except(sequencePairs.Select(p => p.Item2), (x, y) => MatchSequenceNames(x, y) && MatchSequenceSchemas(x, y))
         .Select(s => OperationFactory.CreateSequenceOperation(s)));
 }
Exemplo n.º 2
0
        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));
        }