このコミットが含まれているのは:
@@ -0,0 +1,15 @@
|
||||
module EventRecords
|
||||
# Read the database contract without requiring an application Event model.
|
||||
class EventRow < ActiveRecord::Base
|
||||
self.table_name = 'events'
|
||||
end
|
||||
|
||||
def event_rows
|
||||
EventRow.order(:id).map(&:attributes)
|
||||
end
|
||||
|
||||
def create_event! event_type:, created_by_user: nil
|
||||
EventRow.create!(event_type:, created_by_user_id: created_by_user&.id,
|
||||
created_at: Time.current)
|
||||
end
|
||||
end
|
||||
@@ -3,11 +3,13 @@ require 'cgi'
|
||||
# SQL fixtures use the migration contract without inventing application models.
|
||||
# Include explicitly; these helpers must not affect unrelated examples.
|
||||
module TagGroupRecords
|
||||
include EventRecords
|
||||
|
||||
GROUP_TABLES = [
|
||||
'tag_groups', 'tag_group_tags', 'tag_group_groups',
|
||||
'tag_group_placements', 'tag_group_versions'].freeze
|
||||
WRITE_TABLES = GROUP_TABLES + [
|
||||
'tag_names', 'tag_description_versions',
|
||||
'events', 'tag_names', 'tag_description_versions',
|
||||
'tag_descriptions']
|
||||
|
||||
def group_connection = ApplicationRecord.connection
|
||||
@@ -114,6 +116,7 @@ module TagGroupRecords
|
||||
group_id = insert_group_row('tag_groups', attributes)
|
||||
insert_group_row('tag_group_versions', {
|
||||
tag_group_id: group_id, version_no: 1, event_type: 'create',
|
||||
event_id: create_event!(event_type: 'tag_groups.create', created_by_user: user).id,
|
||||
name:, description:, members: members.to_json, placements: placements.to_json,
|
||||
created_by_user_id: user.id, created_at: now })
|
||||
members.each do |member|
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする