Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defaultValueSql parameter is null but computedColumnSql is used instead #4632

Closed
gmartinezsan opened this issue Feb 24, 2016 · 3 comments
Closed

Comments

@gmartinezsan
Copy link

When overriding the ColumnDefinition method for the MySQL provider implementation the defaultValueSql parameter is always null even though the usage of the HasDefaultValueSql. Which seems to me that it should be assigned in the defaultValueSql parameter. Apparently the usage of ValueGeneratedOnAddOrUpdate in OnModelCreating method is causing that the value always is assigned to the computedColumnSql parameter.

how to reproduce it

Define an entity with the HasDefaultValueSql method. For example

  modelBuilder.Entity<Employee>()
         .Property(p => p.Timestamp)
         .HasDefaultValueSql("CURRENT_TIMESTAMP")
         .ValueGeneratedOnAddOrUpdate();

The table create script created does not include the current_timestamp default value on this column.

We also need to have a way to specify that the value only should be generated in the Update. Is there any way to specify it already?

Could you please give any guidance or explain if this working as expected?

Thanks in advance!

@rowanmiller
Copy link
Contributor

Hey,

We are planning to change this. Currently HasDefaultValueSql + ValueGeneratedOnAddOrUpdate is interpreted to mean "computed column"... but this is not desirable so #4501 is tracking changing this behavior.

~Rowan

@gmartinezsan
Copy link
Author

Thanks for clarifying. I will track that one for the updates.

@rowanmiller
Copy link
Contributor

Sounds good, I'll close this one out.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants