private ExecutedMigration ParseExecutedMigration(SqlDataReader reader) { var item = new ExecutedMigration() { Id = (int)reader["Id"], LastRunDate = (DateTime)reader["LastRunDate"], LastRunScript = (string)reader["LastRunScript"], MigrationId = (string)reader["MigrationId"], MigrationNodeId = (string)reader["MigrationNodeId"], MigrationRunnerId = (string)reader["MigrationRunnerId"] }; return(item); }
private SqlCommand GetExecutedMigrationInsertQueryCommand(ExecutedMigration executedMigration) { string query = @"INSERT INTO [dbo].[DbM_ExecutedMigration] ([MigrationRunnerId] ,[MigrationNodeId] ,[MigrationId] ,[LastRunDate] ,[LastRunScript]) VALUES (@MigrationRunnerId ,@MigrationNodeId ,@MigrationId ,@LastRunDate ,@LastRunScript); "; SqlCommand command = new SqlCommand(query); command.Parameters.Add(new SqlParameter("MigrationRunnerId", executedMigration.MigrationRunnerId) { SqlDbType = System.Data.SqlDbType.VarChar, Size = 80 }); command.Parameters.Add(new SqlParameter("MigrationNodeId", executedMigration.MigrationNodeId) { SqlDbType = System.Data.SqlDbType.VarChar, Size = 100 }); command.Parameters.Add(new SqlParameter("MigrationId", executedMigration.MigrationId) { SqlDbType = System.Data.SqlDbType.VarChar, Size = 150 }); command.Parameters.Add(new SqlParameter("LastRunDate", executedMigration.LastRunDate)); command.Parameters.Add(new SqlParameter("LastRunScript", executedMigration.LastRunScript) { SqlDbType = System.Data.SqlDbType.VarChar, Size = Int32.MaxValue }); return(command); }
private MySqlCommand GetExecutedMigrationInsertQueryCommand(ExecutedMigration executedMigration) { string query = @"INSERT INTO DbM_ExecutedMigration (MigrationRunnerId ,MigrationNodeId ,MigrationId ,LastRunDate ,LastRunScript) VALUES (@MigrationRunnerId ,@MigrationNodeId ,@MigrationId ,@LastRunDate ,@LastRunScript); "; MySqlCommand command = new MySqlCommand(query); command.Parameters.Add(new MySqlParameter("MigrationRunnerId", executedMigration.MigrationRunnerId) { MySqlDbType = MySqlDbType.VarChar, Size = 80 }); command.Parameters.Add(new MySqlParameter("MigrationNodeId", executedMigration.MigrationNodeId) { MySqlDbType = MySqlDbType.VarChar, Size = 100 }); command.Parameters.Add(new MySqlParameter("MigrationId", executedMigration.MigrationId) { MySqlDbType = MySqlDbType.VarChar, Size = 150 }); command.Parameters.Add(new MySqlParameter("LastRunDate", executedMigration.LastRunDate)); command.Parameters.Add(new MySqlParameter("LastRunScript", executedMigration.LastRunScript) { MySqlDbType = MySqlDbType.VarChar, Size = Int32.MaxValue }); return(command); }