CREATE TABLE raid_builder.raid_instance_person_character_xref(
	raid_instance_person_character_xref_id uuid PRIMARY KEY,
	raid_instance_id uuid REFERENCES raid_builder.raid_instance(raid_instance_id) NOT NULL,
	person_character_id uuid REFERENCES raid_builder.person_character(person_character_id),
	group_number int NOT NULL,
	position_number int NOT NULL,

	--Auditing
	modified_by uuid,
	modified_date timestamptz,
	created_by uuid NOT NULL,
	created_date timestamptz NOT NULL
);

CREATE INDEX idx_raid_instance_person_character_xref_raid_instance_id ON raid_builder.raid_instance_person_character_xref(raid_instance_id);
CREATE INDEX idx_raid_instance_person_character_xref_person_character_id ON raid_builder.raid_instance_person_character_xref(person_character_id);

GRANT ALL ON TABLE raid_builder.raid_instance_person_character_xref TO raid_builder;
