Esempio n. 1
0
        public virtual IReadOnlyList <MigrationOperation> DropSchema([NotNull] IModel model)
        {
            Check.NotNull(model, "model");

            _operations = new MigrationOperationCollection();

            _operations.AddRange(GetSequences(model).Select(
                                     s => OperationFactory.DropSequenceOperation(s)));

            _operations.AddRange(model.EntityTypes.Select(
                                     t => OperationFactory.DropTableOperation(t)));

            return(OperationProcessor.Process(_operations, model, new Model()));
        }
Esempio 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 Model(), model));
        }
Esempio n. 3
0
 private void FindMovedTables(
     IEnumerable <Tuple <IEntityType, IEntityType> > tablePairs)
 {
     _operations.AddRange(
         tablePairs
         .Where(pair => !MatchTableSchemas(pair.Item1, pair.Item2))
         .Select(pair => OperationFactory.MoveTableOperation(pair.Item1, pair.Item2)));
 }