Commit b6ac739b authored by Marin Jankovski's avatar Marin Jankovski Committed by Valery Sizov

Fix broken ldap migration.

parent d72274bb
...@@ -4,16 +4,10 @@ class RenameLdapGroupToLdapGroupLink < ActiveRecord::Migration ...@@ -4,16 +4,10 @@ class RenameLdapGroupToLdapGroupLink < ActiveRecord::Migration
# NOTE: we use the old_ methods because the new methods are overloaded # NOTE: we use the old_ methods because the new methods are overloaded
# for backwards compatibility # for backwards compatibility
time = Time.now.strftime('%Y-%m-%d %H:%M:%S')
Group.where.not(ldap_cn: nil).each do |group| execute "INSERT INTO ldap_group_links ( group_access, cn, group_id, created_at, updated_at )
# Make sure we use the database column, not the model methods SELECT ldap_access, ldap_cn, id, DATE('#{time}'), DATE('#{time}') FROM namespaces
ldap_cn = group.read_attribute(:ldap_cn) WHERE ldap_cn IS NOT NULL;"
ldap_access = group.read_attribute(:ldap_access)
group.ldap_group_links.where(cn: ldap_cn).first_or_create do |ldap_group_link|
ldap_group_link.group_access = ldap_access
end
end
end end
def down def down
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment