CREATE TABLE raid_builder.class_group(
	class_group_id uuid PRIMARY KEY,
	raid_group_id uuid REFERENCES raid_builder.raid_group(raid_group_id) NOT NULL,
	class_group_name text NOT NULL,

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

CREATE INDEX idx_class_group_raid_group_id ON raid_builder.class_group(raid_group_id);

GRANT ALL ON TABLE raid_builder.class_group TO raid_builder;



CREATE TABLE raid_builder.class_group_game_class_xref(
	class_group_game_class_xref_id uuid PRIMARY KEY,
	class_group_id uuid REFERENCES raid_builder.class_group(class_group_id) NOT NULL,
	game_class_id uuid REFERENCES raid_builder.game_class(game_class_id) NOT NULL,

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

CREATE INDEX idx_class_group_game_class_xref_class_group_id ON raid_builder.class_group_game_class_xref(class_group_id);
CREATE INDEX idx_class_group_game_class_xref_game_class_id ON raid_builder.class_group_game_class_xref(game_class_id);

GRANT ALL ON TABLE raid_builder.class_group_game_class_xref TO raid_builder;
