Add migration

This commit is contained in:
2015-09-09 22:53:26 -04:00
parent 56dd091178
commit 77783c1fad
5 changed files with 197 additions and 0 deletions
+1
View File
@@ -12,6 +12,7 @@ namespace MileageTraker.Web.Context
public DbSet<User> Users { get; set; }
public DbSet<Role> Roles { get; set; }
public DbSet<PurposeType> PurposeTypes { get; set; }
public DbSet<FuelLog> FuelLogs { get; set; }
/*
* WebSecurity.Register("Demo", "123456", "demo@demo.com", true, "Demo", "Demo");
+29
View File
@@ -0,0 +1,29 @@
// <auto-generated />
namespace MileageTraker.Web.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class FuelLog : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(FuelLog));
string IMigrationMetadata.Id
{
get { return "201509100253084_FuelLog"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
+38
View File
@@ -0,0 +1,38 @@
namespace MileageTraker.Web.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class FuelLog : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.FuelLog",
c => new
{
FuelLogId = c.Int(nullable: false, identity: true),
Date = c.DateTime(nullable: false),
DriverFullName = c.String(nullable: false, maxLength: 128),
TagNumber = c.String(nullable: false),
Odometer = c.Int(nullable: false),
CityName = c.String(maxLength: 64),
MPG = c.Double(nullable: false),
GasPurchased = c.Double(nullable: false),
TotalPrice = c.Decimal(nullable: false, precision: 18, scale: 2),
Log_LogId = c.Int(),
})
.PrimaryKey(t => t.FuelLogId)
.ForeignKey("dbo.Log", t => t.Log_LogId)
.Index(t => t.Log_LogId);
}
public override void Down()
{
DropForeignKey("dbo.FuelLog", "Log_LogId", "dbo.Log");
DropIndex("dbo.FuelLog", new[] { "Log_LogId" });
DropTable("dbo.FuelLog");
}
}
}
File diff suppressed because one or more lines are too long
+3
View File
@@ -5,6 +5,9 @@ namespace MileageTraker.Web.Models
{
public class FuelLog
{
[Key]
public int FuelLogId { get; set; }
[Required]
[DataType(DataType.Date)]
public DateTime Date { get; set; }