如何使用会议室数据库迁移来更新现有数据?

时间:2018-10-12 15:36:54

标签: android android-room android-architecture-components

我正在使用会议室数据库,并且有这样的用户对象,

@Configuration
public class RabbitMQConfiguration {

    public final static String AUTHENTICATION_EMAILS_QUEUE = "AUTHENTICATION_EMAILS_QUEUE";
    public final static String EMAIL_MESSAGE_EXCHANGE_NAME = "EMAIL_EVENTS";

    @Bean
    public Queue authenticationEmailsQueue() {
        return new Queue(AUTHENTICATION_EMAILS_QUEUE, false);
    }

    @Bean
    public DirectExchange emailMessagesExchange() {
        return new DirectExchange(EMAIL_MESSAGE_EXCHANGE_NAME);
    }

    @Bean
    public Binding authenticationEmailMQBinding(Queue queue, DirectExchange exchange) {
        return BindingBuilder.bind(queue).to(exchange).with(AUTHENTICATION_EMAILS_QUEUE);
    }

    @Bean
    public SimpleMessageListenerContainer authenticationEmailContainer(ConnectionFactory connectionFactory,
    MessageListenerAdapter listenerAdapter) {
        SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
        container.setConnectionFactory(connectionFactory);
        container.setQueueNames(AUTHENTICATION_EMAILS_QUEUE);
        container.setMessageListener(listenerAdapter);
        return container;
    }

    @Bean
    public MessageListenerAdapter authenticationEmailHandlerAdapter(AuthenticationEmailHandler receiver) {
        return new MessageListenerAdapter(receiver, "receiveMessage");
    }

}

有成千上万的用户添加了他们的邮件。我发现许多用户的邮件都有拼写错误。在下一个版本中,我要修复拼写错误。

因此,我将会议室数据库版本1增加到2,并提供了迁移类,但是我不知道如何使用会议室更新拼写错误的数据。我是否需要实施迁移或其他?

0 个答案:

没有答案