Sha256: ee5661e1a63cc91a15477efb026cf6b13cbaf42659e09fbcf6bee10df56eff70
Contents?: true
Size: 891 Bytes
Versions: 77
Compression:
Stored size: 891 Bytes
Contents
# frozen_string_literal: true class ChangeNewsletterNotificationTypeValue < ActiveRecord::Migration[5.2] class User < ApplicationRecord self.table_name = :decidim_users end def up add_column :decidim_users, :newsletter_token, :string, default: "" add_column :decidim_users, :newsletter_notifications_at, :datetime User.reset_column_information User.where(newsletter_notifications: true).update(newsletter_notifications_at: Time.zone.parse("2018-05-24 00:00 +02:00")) remove_column :decidim_users, :newsletter_notifications end def down add_column :decidim_users, :newsletter_notifications, :boolean User.reset_column_information User.where.not(newsletter_notifications_at: nil).update(newsletter_notifications: true) remove_column :decidim_users, :newsletter_notifications_at remove_column :decidim_users, :newsletter_token end end
Version data entries
77 entries across 77 versions & 1 rubygems