Sha256: 1d59b177fcf862ccd94114f985d0e7a9b9b743f15eb7510e36b2a393c022d578

Contents?: true

Size: 750 Bytes

Versions: 74

Compression:

Stored size: 750 Bytes

Contents

# frozen_string_literal: true

class AddRolesToMemberships < ActiveRecord::Migration[5.2]
  def up
    add_column :decidim_user_group_memberships, :role, :string, default: "requested"
    execute("UPDATE decidim_user_group_memberships SET role = 'creator'")
    change_column_null :decidim_user_group_memberships, :role, false
    add_index(
      :decidim_user_group_memberships,
      %w(role decidim_user_group_id),
      where: "(role = 'creator')",
      name: "decidim_group_membership_one_creator_per_group",
      unique: true
    )
  end

  def down
    remove_column :decidim_user_group_memberships, :role
    remove_index(
      :decidim_user_group_memberships,
      name: "decidim_group_membership_one_creator_per_group"
    )
  end
end

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
decidim-core-0.25.0.rc4 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.25.0.rc3 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.25.0.rc2 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.25.0.rc1 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.24.3 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.23.6 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.24.2 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.23.5 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.24.1 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.24.0 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.24.0.rc2 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.23.4 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.24.0.rc1 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.23.3 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.23.2 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.23.1 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.23.1.rc1 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.23.0 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.22.0 db/migrate/20181011080252_add_roles_to_memberships.rb
decidim-core-0.21.0 db/migrate/20181011080252_add_roles_to_memberships.rb