Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Database schema can not be updated

$
0
0

Hi,

I am in tutorial "Building your first MVC 6 application" section "Adding Validation": https://docs.asp.net/en/latest/tutorials/first-mvc-app/validation.html

here is the problem, when I ran

dnx ef migrations add DataAnnotations
dnx ef database update

my database schema, ie. Movies schema, is not updated! According to the tutorial, the validation attributes should be updated in my database. There is no error message, everything looks fine and there is no complaint from either Visual Studio or command line prompt. I double checked the machine generated file "20160412125533_DataAnnotations.Designer.cs", there is

partialclassDataAnnotations

{       

    protectedoverridevoid BuildTargetModel(ModelBuilder modelBuilder)

        {    .................

           modelBuilder.Entity( "MvcMovie.Models.Movie", b =>

                {

                    b.Property<int>("ID").ValueGeneratedOnAdd();

                    b.Property<string>("Genre").IsRequired()

                        .HasAnnotation("MaxLength", 30);

                    b.Property<decimal>("Price");

                    b.Property<string>("Rating")

                        .HasAnnotation("MaxLength", 5);

                    b.Property<DateTime>("ReleaseDate");

                    b.Property<string>("Title")

                        .HasAnnotation("MaxLength", 60);

                    b.HasKey("ID");

                });

       ..................

}}

So it seems has been updated, then why not my database schema?

Thanks a lot!


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>