Create a database table with a "function" default, eg. a date with a curr_date()
scaffold:
dotnet ef dbcontext scaffold "Server=localhost;Database=fdb;User=root;Password=;TreatTinyAsBoolean=true;" "Pomelo.EntityFrameworkCore.MySql" -o Model
.HasDefaultValueSql("'curdate()'"); is generated in OnModelCreating in the db context
**_doesn't effect functioning (does not impact use of the model) until/if the context is used to create a migration/update the database
the single quotation marks are invalid_**
MySQL version: 10.4.14-mariadb
Pomelo.EntityFrameworkCore.MySql version: 5.0.0-alpha.2
The main issue here is, that MariaDB allows the usage of curdate() as a default for datetime and timestamp columns, while MySQL doesn't.
Therefore, we need to handle cases like that for MariaDB.
@stephenson-heritage Thanks for reporting this issue! The fix is now part of our nightly builds and will ship with 5.0.0-alpha.3.
Most helpful comment
@stephenson-heritage Thanks for reporting this issue! The fix is now part of our nightly builds and will ship with
5.0.0-alpha.3.