asp.net-mvc - 使用迁移将表添加到数据库
问题描述
我对模型进行了一些更改,其中包括向类添加新字段并创建新类(表),如下所示:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
namespace SurveyTool.Models
{
public class Industry
{
[Key]
public int ID { get; set; }
public string name { get; set; }
}
}
当 IAdd-Migration
和Update-Database
时,添加了新字段。但是,新表不是。我再次尝试了这个过程,最新的迁移是空的。
为什么添加新表的标准流程不起作用?
谢谢!
解决方案
推荐阅读
- asp.net-core - 找不到类型或命名空间名称“App”?
- php - 如何将 Excel 日期格式化为 PHP?
- twig - 我无法使用 Symfnony 5 使用 render() 创建页面
- shell - 使用 sed 删除两个模式之间的字符
- android - 如何使用广播android将数据从一个应用程序发送到另一个应用程序
- javascript - React - 生产如何读取 .env 文件?
- opencv - findChessboardCorners 失败
- swift - 如何更改安全区域的颜色?
- node.js - Gunzip缓冲区并写入文件
- flutter - Flutter 视频播放器质量选择器