class OldRelationMember < ApplicationRecord
self.table_name = "relation_members"
- self.primary_key = %w[relation_id version sequence_id]
belongs_to :old_relation, :query_constraints => [:relation_id, :version], :inverse_of => :old_members
# A bit messy, referring to the current tables, should do for the data browser for now
class RelationMember < ApplicationRecord
self.table_name = "current_relation_members"
- self.primary_key = %w[relation_id sequence_id]
belongs_to :relation
belongs_to :member, :polymorphic => true
--- /dev/null
+class CorrectRelationMembersPrimaryKey < ActiveRecord::Migration[7.0]
+ def up
+ alter_primary_key :current_relation_members, [:relation_id, :sequence_id]
+ alter_primary_key :relation_members, [:relation_id, :version, :sequence_id]
+ end
+
+ def down
+ alter_primary_key :relation_members, [:relation_id, :version, :member_type, :member_id, :member_role, :sequence_id]
+ alter_primary_key :current_relation_members, [:relation_id, :member_type, :member_id, :member_role, :sequence_id]
+ end
+end
--
ALTER TABLE ONLY public.current_relation_members
- ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, member_type, member_id, member_role, sequence_id);
+ ADD CONSTRAINT current_relation_members_pkey PRIMARY KEY (relation_id, sequence_id);
--
--
ALTER TABLE ONLY public.relation_members
- ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, member_type, member_id, member_role, sequence_id);
+ ADD CONSTRAINT relation_members_pkey PRIMARY KEY (relation_id, version, sequence_id);
--
('23'),
('22'),
('21'),
+('20231010194809'),
('20231007141103'),
('20230830115220'),
('20230830115219'),