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

Version Path
decidim-core-0.29.1 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.28.4 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.27.9 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.29.0 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.28.3 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.27.8 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.29.0.rc4 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.29.0.rc3 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.29.0.rc2 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.29.0.rc1 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.28.2 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.27.7 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.28.1 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.27.6 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.26.10 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.26.9 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.28.0 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.27.5 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.28.0.rc5 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.28.0.rc4 db/migrate/20180611121852_change_newsletter_notification_type_value.rb