Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- El error que me da es este
- fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
- Failed executing DbCommand (12ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
- ALTER TABLE `Users` MODIFY COLUMN `LastUpdateDateTime` datetime(6) NULL DEFAULT getdate();
- Failed executing DbCommand (12ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
- ALTER TABLE `Users` MODIFY COLUMN `LastUpdateDateTime` datetime(6) NULL DEFAULT getdate();
- MySqlConnector.MySqlException (0x80004005): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'getdate()' at line 1
- at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in /_/src/MySqlConnector/Core/ResultSet.cs:line 50
- at MySqlConnector.MySqlDataReader.ActivateResultSet(CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 135
- at MySqlConnector.MySqlDataReader.CreateAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, IDictionary`2 cachedProcedures, IMySqlCommand command, CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 444
- at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(IReadOnlyList`1 commands, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/CommandExecutor.cs:line 60
- at MySqlConnector.MySqlCommand.ExecuteNonQueryAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 271
- at MySqlConnector.MySqlCommand.ExecuteNonQuery() in /_/src/MySqlConnector/MySqlCommand.cs:line 101
- at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
- at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
- at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
- at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
- at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String connectionString, String contextType)
- at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String connectionString, String contextType)
- at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
- at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'getdate()' at line 1
- Vale creo que el fallo es que el getdate() no funciona ahí donde lo he puesto, pero entonces si no pongo nada estamos diciendo que la fecha la tiene que poner el usuario, y lo que necesito es que la base de datos sea la que la ponga.
- Si lo veo muy complicado al final pasaré del tema y lo pondre que el usuario la tenga que poner y listo sin hora ni na solo fecha del dia o algo así amenos de momento porque lo veo bastante lioso el tema este.
- Esto dentro del método
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<User>(entity =>
- {
- entity.Property(e => e.CreationDateTime).HasDefaultValueSql("getdate()");
- });
- modelBuilder.Entity<User>(entity =>
- {
- entity.Property(e => e.LastUpdateDateTime).HasDefaultValueSql("getdate()");
- });
- }
- Tengo mas cosas puestas dentro pero no interfieren para nada con este tema, lo que veo que esta mal es getdate() como parametro en mysql en el esos 2 campos con que falle en uno ya esta mal en los 2 campos logivcamente.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement