Merge branch 'registry-700' into registry-694

# Conflicts:
#	db/structure.sql
This commit is contained in:
Artur Beljajev 2018-02-17 02:37:13 +02:00
commit 709dba7664
54 changed files with 535 additions and 274 deletions

View file

@ -0,0 +1,5 @@
class ChangeEppSessionsSessionIdToNotNull < ActiveRecord::Migration
def change
change_column_null :epp_sessions, :session_id, false
end
end

View file

@ -0,0 +1,5 @@
class AddEppSessionsUserId < ActiveRecord::Migration
def change
add_reference :epp_sessions, :user, foreign_key: true
end
end

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

@ -0,0 +1,5 @@
class RemoveEppSessionsRegistrarId < ActiveRecord::Migration
def change
remove_column :epp_sessions, :registrar_id, :integer
end
end

View file

@ -0,0 +1,13 @@
class AddEppSessionsSessionIdUniqueConstraint < ActiveRecord::Migration
def up
execute <<-SQL
ALTER TABLE epp_sessions ADD CONSTRAINT unique_session_id UNIQUE (session_id)
SQL
end
def down
execute <<-SQL
ALTER TABLE epp_sessions DROP CONSTRAINT unique_session_id
SQL
end
end

View file

@ -0,0 +1,5 @@
class RemoveEppSessionsSessionIdUniqueIndex < ActiveRecord::Migration
def change
remove_index :epp_sessions, name: :index_epp_sessions_on_session_id
end
end

View file

@ -0,0 +1,5 @@
class ChangeEppSessionsUserIdToNotNull < ActiveRecord::Migration
def change
change_column_null :epp_sessions, :user_id, false
end
end

View file

@ -1050,11 +1050,10 @@ ALTER SEQUENCE domains_id_seq OWNED BY domains.id;
CREATE TABLE epp_sessions (
id integer NOT NULL,
session_id character varying,
data text,
session_id character varying NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
registrar_id integer
user_id integer NOT NULL
);
@ -3635,6 +3634,14 @@ ALTER TABLE ONLY contacts
ADD CONSTRAINT unique_contact_code UNIQUE (code);
--
-- Name: unique_session_id; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY epp_sessions
ADD CONSTRAINT unique_session_id UNIQUE (session_id);
--
-- Name: unique_zone_origin; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
@ -3886,13 +3893,6 @@ CREATE INDEX index_domains_on_registrar_id ON domains USING btree (registrar_id)
CREATE INDEX index_domains_on_statuses ON domains USING gin (statuses);
--
-- Name: index_epp_sessions_on_session_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX index_epp_sessions_on_session_id ON epp_sessions USING btree (session_id);
--
-- Name: index_epp_sessions_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
@ -4484,6 +4484,14 @@ ALTER TABLE ONLY domain_transfers
ADD CONSTRAINT fk_rails_87b8e40c63 FOREIGN KEY (domain_id) REFERENCES domains(id);
--
-- Name: fk_rails_adff2dc8e3; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY epp_sessions
ADD CONSTRAINT fk_rails_adff2dc8e3 FOREIGN KEY (user_id) REFERENCES users(id);
--
-- Name: fk_rails_b80dbb973d; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@ -5070,6 +5078,22 @@ INSERT INTO schema_migrations (version) VALUES ('20180126104536');
INSERT INTO schema_migrations (version) VALUES ('20180126104903');
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');
INSERT INTO schema_migrations (version) VALUES ('20180212123810');
INSERT INTO schema_migrations (version) VALUES ('20180212152810');
INSERT INTO schema_migrations (version) VALUES ('20180212154731');
INSERT INTO schema_migrations (version) VALUES ('20180213183818');
INSERT INTO schema_migrations (version) VALUES ('20180214200224');
INSERT INTO schema_migrations (version) VALUES ('20180214213743');