Sha256: 7522a21a34274e43dbd009dd2a87158e8df4ed1dbad0a547c0dd6d2236683eb1
Contents?: true
Size: 854 Bytes
Versions: 71
Compression:
Stored size: 854 Bytes
Contents
# frozen_string_literal: true class CreateUniqueNicknames < ActiveRecord::Migration[5.1] class User < ApplicationRecord include Decidim::Nicknamizable self.table_name = :decidim_users end def up add_column :decidim_users, :nickname, :string, limit: 20 User.where.not(name: nil).find_each do |user| user.update!(nickname: UserBaseEntity.nicknamize(user.name, decidim_organization_id: user.decidim_organization_id)) end add_index :decidim_users, %w(nickname decidim_organization_id), where: "(deleted_at IS NULL) AND (managed = 'f')", name: "index_decidim_users_on_nickame_and_decidim_organization_id", unique: true end def down remove_index :decidim_users, %w(nickname decidim_organization_id) remove_column :decidim_users, :nickname end end
Version data entries
71 entries across 71 versions & 1 rubygems