有些模型我无法删除我的迁移。它必须包括关系而不删除其他迁移或删除我的数据库。
问题:还有另一种方法不能再次创建表吗?
我可以删除名为relacion
的迁移。
过去的模特:
[Key]
public int beneficiarioId { get; set; }
public string nombreBeneficiario { get; set; }
public string apellidoBeneficiario { get; set; }
public string cedula { get; set; }
public string resolucion { get; set; }
public string nombreBeneficio { get; set; }
public string siglas { get; set; }
public string tipoBeca { get; set; }
public string estado { get; set; }
public int mesInicio { get; set; }
public int anoInicio { get; set; }
public int mesVence { get; set; }
public int anoVence { get; set; }
public int montoTotal { get; set; }
public decimal montoOtorgado { get; set; }
public decimal montoPendiente { get; set; }
public string fuente { get; set; }
public string codigoPlastico { get; set; }
public string fotoUrl { get; set; }
public string firmaUrl { get; set; }
public bool impreso { get; set; }
public string fechaImpreso { get; set; }
public class ApplicationUser : IdentityUser
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Tenga en cuenta que el valor de authenticationType debe coincidir con el definido en CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Agregar aquí notificaciones personalizadas de usuario
return userIdentity;
}
}
当前型号:
[Key]
public int beneficiarioId { get; set; }
public string UserId { get; set; }
public string nombreBeneficiario { get; set; }
public string apellidoBeneficiario { get; set; }
public string cedula { get; set; }
public string resolucion { get; set; }
public string nombreBeneficio { get; set; }
public string siglas { get; set; }
public string tipoBeca { get; set; }
public string estado { get; set; }
public int mesInicio { get; set; }
public int anoInicio { get; set; }
public int mesVence { get; set; }
public int anoVence { get; set; }
public int montoTotal { get; set; }
public decimal montoOtorgado { get; set; }
public decimal montoPendiente { get; set; }
public string fuente { get; set; }
public string codigoPlastico { get; set; }
public string fotoUrl { get; set; }
public string firmaUrl { get; set; }
public bool impreso { get; set; }
public string fechaImpreso { get; set; }
public ApplicationUser ApplicationUsers { get; set; }
public class ApplicationUser : IdentityUser
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Tenga en cuenta que el valor de authenticationType debe coincidir con el definido en CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Agregar aquí notificaciones personalizadas de usuario
return userIdentity;
}
public virtual ICollection<Beneficiario> Beneficiarios { get; set; }
}
过去的迁移:
public override void Up()
{
CreateTable(
"dbo.Beneficiarios",
c => new
{
beneficiarioId = c.Int(nullable: false, identity: true),
nombreBeneficiario = c.String(),
apellidoBeneficiario = c.String(),
cedula = c.String(),
resolucion = c.String(),
nombreBeneficio = c.String(),
siglas = c.String(),
tipoBeca = c.String(),
estado = c.String(),
mesInicio = c.Int(nullable: false),
anoInicio = c.Int(nullable: false),
mesVence = c.Int(nullable: false),
anoVence = c.Int(nullable: false),
montoTotal = c.Int(nullable: false),
montoOtorgado = c.Decimal(nullable: false, precision: 18, scale: 2),
montoPendiente = c.Decimal(nullable: false, precision: 18, scale: 2),
fuente = c.String(),
fotoUrl = c.String(),
})
.PrimaryKey(t => t.beneficiarioId);
}
public override void Down()
{
DropTable("dbo.Beneficiarios");
}
上次迁移:
public override void Up()
{
CreateTable(
"dbo.Beneficiarios",
c => new
{
beneficiarioId = c.Int(nullable: false, identity: true),
UserId = c.String(nullable: false, maxLength: 128),
nombreBeneficiario = c.String(),
apellidoBeneficiario = c.String(),
cedula = c.String(),
resolucion = c.String(),
nombreBeneficio = c.String(),
siglas = c.String(),
tipoBeca = c.String(),
estado = c.String(),
mesInicio = c.Int(nullable: false),
anoInicio = c.Int(nullable: false),
mesVence = c.Int(nullable: false),
anoVence = c.Int(nullable: false),
montoTotal = c.Int(nullable: false),
montoOtorgado = c.Decimal(nullable: false, precision: 18, scale: 2),
montoPendiente = c.Decimal(nullable: false, precision: 18, scale: 2),
fuente = c.String(),
codigoPlastico = c.String(),
fotoUrl = c.String(),
firmaUrl = c.String(),
impreso = c.Boolean(nullable: false),
fechaImpreso = c.String(),
})
.PrimaryKey(t => t.beneficiarioId)
.ForeignKey("dbo.Users", t => t.UserId)
.Index(t => t.UserId);
}
public override void Down()
{
DropForeignKey("dbo.Beneficiarios", "UserId", "dbo.Users");
DropIndex("dbo.Beneficiarios", new[] { "UserId" });
DropTable("dbo.Beneficiarios");
}
问题:
已经有一个名为&#39; Beneficiarios&#39;在数据库中。