Пример #1
0
        public void FindMissingColumn()
        {
            var table = new DocumentTable("Entities");

            table.Add(new Column <int>("Number"));

            schema.Add(table.Name, table.Columns.Select(x => x.Name).ToList());

            configuration.Document <Entity>();

            var commands = migrator.CalculateSchemaChanges(schema, configuration).Cast <RemoveColumn>().ToList();

            commands[0].Table.ShouldBe(GetTableFor <Entity>());
            commands[0].Name.ShouldBe("Number");
        }
Пример #2
0
        public void FindColumnTypeChange()
        {
            var table = new DocumentTable("Entities");

            table.Add(new Column <int>("Number"));

            schema.Add(table.Name, table.Columns.Select(x => x.Name).ToList());

            configuration.Document <Entity>().With("Number", x => x.String);

            var commands = migrator.CalculateSchemaChanges(schema, configuration).ToList();

            commands[0].ShouldBeOfType <AddColumn>()
            .Tablename.ShouldBe(GetTableFor <Entity>().Name);
            ((AddColumn)commands[0]).Column.ShouldBe(GetTableFor <Entity>()["Number"]);

            commands[1].ShouldBeOfType <RemoveColumn>()
            .Table.ShouldBe(GetTableFor <Entity>());
            ((RemoveColumn)commands[1]).Name.ShouldBe("Number");
        }