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.25.0.rc4 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.25.0.rc3 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.25.0.rc2 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.25.0.rc1 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.24.3 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.23.6 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.24.2 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.23.5 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.24.1 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.24.0 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.24.0.rc2 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.23.4 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.24.0.rc1 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.23.3 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.23.2 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.23.1 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.23.1.rc1 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.23.0 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.22.0 db/migrate/20180611121852_change_newsletter_notification_type_value.rb
decidim-core-0.21.0 db/migrate/20180611121852_change_newsletter_notification_type_value.rb