Commit 18411645 authored by James Lopez's avatar James Lopez

add initial migrations

parent cb6af816
......@@ -91,6 +91,7 @@ class Project < ActiveRecord::Base
attr_accessor :new_default_branch
attr_accessor :old_path_with_namespace
attr_encrypted :import_credentials, key: Gitlab::Application.secrets.db_key_base
# Relations
belongs_to :creator, foreign_key: 'creator_id', class_name: 'User'
......
class AddImportCredentialsToProjects < ActiveRecord::Migration
def change
add_column :projects, :encrypted_import_credentials, :text
add_column :projects, :encrypted_import_credentials_iv, :text
end
end
class RemoveWrongImportUrlFromProjects < ActiveRecord::Migration
def up
projects_with_wrong_import_url.each do |project|
project.update_columns(import_url: nil) # TODO Check really nil?
# TODO: migrate current credentials to import_credentials?
# TODO: Notify user ?
end
end
private
def projects_with_dot_atom
# TODO Check live with #operations for possible false positives. Also, consider regex? But may have issues MySQL/PSQL
select_all("SELECT p.id from projects p WHERE p.import_url LIKE '%//%:%@%' or p.import_url like '#{"_"*40}@github.com%'")
end
end
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