Migrate epp_sessions.data to user_id

#700
This commit is contained in:
Artur Beljajev 2018-02-07 09:40:35 +02:00
parent c5f8c7e1e8
commit 38f967a7d6
3 changed files with 19 additions and 1 deletions

View file

@ -0,0 +1,10 @@
class ExtractUserIdFromEppSessionsData < ActiveRecord::Migration
def change
EppSession.all.each do |epp_session|
user_id = Marshal.load(::Base64.decode64(epp_session.data_before_type_cast))[:api_user_id]
user = ApiUser.find(user_id)
epp_session.user = user
epp_session.save!
end
end
end

View file

@ -0,0 +1,5 @@
class RemoveEppSessionsData < ActiveRecord::Migration
def change
remove_column :epp_sessions, :data, :string
end
end

View file

@ -1051,7 +1051,6 @@ ALTER SEQUENCE domains_id_seq OWNED BY domains.id;
CREATE TABLE epp_sessions (
id integer NOT NULL,
session_id character varying NOT NULL,
data text,
created_at timestamp without time zone,
updated_at timestamp without time zone,
registrar_id integer,
@ -5083,3 +5082,7 @@ INSERT INTO schema_migrations (version) VALUES ('20180206213435');
INSERT INTO schema_migrations (version) VALUES ('20180206234620');
INSERT INTO schema_migrations (version) VALUES ('20180207071528');
INSERT INTO schema_migrations (version) VALUES ('20180207072139');