rename tokens in db

pull/8045/head
ulferts 5 years ago
parent 399e8c3ed9
commit 0b342ec0d4
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 6
      config/initializers/zeitwerk.rb
  2. 14
      db/migrate/20200217155632_rename_tokens.rb

@ -1,9 +1,3 @@
# TODO: Token:Rss and Token::Api have been renamed to Token::RSS and Token::API. A migration needs to set the existing data accordingly
# frozen_string_literal: true
module OpenProject
class Inflector < Zeitwerk::GemInflector
# TODO: split up into a registry

@ -0,0 +1,14 @@
class RenameTokens < ActiveRecord::Migration[6.0]
class Token < ActiveRecord::Base
end
def up
Token.where(type: 'Token::Rss').update_all(type: 'Token::RSS')
Token.where(type: 'Token::Api').update_all(type: 'Token::API')
end
def down
Token.where(type: 'Token::RSS').update_all(type: 'Token::Rss')
Token.where(type: 'Token::API').update_all(type: 'Token::Api')
end
end
Loading…
Cancel
Save