2015-08-05 07:23:20 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2015-09-10 06:48:29 +08:00
|
|
|
|
using MBuildModel = RedisMongoMigration.Mongo.BuildModel;
|
|
|
|
|
using MBuild = RedisMongoMigration.Mongo.Build;
|
|
|
|
|
using RBuild = RedisMongoMigration.Redis.Build;
|
2015-09-12 22:23:13 +08:00
|
|
|
|
using MongoLevelOfFlight = RedisMongoMigration.Mongo.MongoLevelOfFlight;
|
|
|
|
|
using RedisLevelOfFlight = RedisMongoMigration.Redis.RedisLevelOfFlight;
|
2015-09-10 06:48:29 +08:00
|
|
|
|
|
2015-08-05 07:23:20 +08:00
|
|
|
|
namespace RedisMongoMigration
|
|
|
|
|
{
|
2015-09-10 06:48:29 +08:00
|
|
|
|
class Program
|
|
|
|
|
{
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
var builds = RBuild.Select();
|
|
|
|
|
var newBuilds = from b in builds
|
|
|
|
|
select new MBuildModel()
|
|
|
|
|
{
|
|
|
|
|
Id = Guid.NewGuid(),
|
|
|
|
|
LegacyId = b.Id,
|
|
|
|
|
|
|
|
|
|
MajorVersion = b.MajorVersion,
|
|
|
|
|
MinorVersion = b.MinorVersion,
|
|
|
|
|
Number = b.Number,
|
|
|
|
|
Revision = b.Revision,
|
|
|
|
|
Lab = b.Lab,
|
|
|
|
|
BuildTime = b.BuildTime,
|
|
|
|
|
|
|
|
|
|
Added = b.Added,
|
|
|
|
|
Modified = b.Modified,
|
|
|
|
|
SourceType = b.SourceType,
|
|
|
|
|
SourceDetails = b.SourceDetails,
|
|
|
|
|
LeakDate = b.LeakDate,
|
2015-09-12 22:23:13 +08:00
|
|
|
|
FlightLevel = ExchangeFlights(b.FlightLevel)
|
2015-09-10 06:48:29 +08:00
|
|
|
|
};
|
|
|
|
|
MBuild m = new MBuild();
|
|
|
|
|
m.InsertAll(newBuilds);
|
|
|
|
|
Console.WriteLine("Builds: Complete");
|
|
|
|
|
Console.ReadKey();
|
|
|
|
|
}
|
2015-09-12 22:23:13 +08:00
|
|
|
|
|
|
|
|
|
static MongoLevelOfFlight ExchangeFlights(RedisLevelOfFlight flight)
|
|
|
|
|
{
|
|
|
|
|
switch (flight)
|
|
|
|
|
{
|
|
|
|
|
case RedisLevelOfFlight.Low:
|
|
|
|
|
return MongoLevelOfFlight.WIS;
|
|
|
|
|
case RedisLevelOfFlight.High:
|
|
|
|
|
return MongoLevelOfFlight.OSG;
|
|
|
|
|
default:
|
|
|
|
|
return MongoLevelOfFlight.None;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-09-10 06:48:29 +08:00
|
|
|
|
}
|
2015-08-05 07:23:20 +08:00
|
|
|
|
}
|