Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

rename tokens in db

ulferts0b342ec0d4ef
diff --git a/config/initializers/zeitwerk.rb b/config/initializers/zeitwerk.rb
index 91558a4f206..8ee9cb6501b 100644
--- a/config/initializers/zeitwerk.rb
+++ b/config/initializers/zeitwerk.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
diff --git a/db/migrate/20200217155632_rename_tokens.rb b/db/migrate/20200217155632_rename_tokens.rb
new file mode 100644
index 00000000000..1d7b75a5450
--- /dev/null
+++ b/db/migrate/20200217155632_rename_tokens.rb
@@ -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