[Group Export] Export creation
What does this MR do?
This MR is part of changes made in !17489 (closed) to introduce Group Export (relations only, it is not fully implemented). I am splitting it in order to made it easier to review. This is the first MR of 3+ that covers Export Creation. There will also be Export Scheduling and Export Processing.
Please read through original MR description to understand reasons and ideas behind these changes. It has a full picture described as well as the end result demo.
These changes are meant to be reviewed and merged into georgekoltsov/group-export-part-1
branch, not master. Once all chunks of these changes are reviewed and merged into the branch, it will go through a new review process, but as one big MR (hopefully just for sanity checks, etc).
Steps to reproduce
rails c
group = Group.last
user = User.first
export_creator = Gitlab::ImportExport::Group::ExportCreator.new(group.id, user.id)
export = export_creator.create
=> #<GroupExport:0x00007fc446656488 id: 3, group_id: 7, status: "created", last_error: nil, created_at: 2019-10-03 15:07:50 UTC, updated_at: 2019-10-03 15:07:50 UTC>
export.parts
[5] pry(main)> _.parts
GroupExportPart Load (0.4ms) SELECT "group_export_parts".* FROM "group_export_parts" WHERE "group_export_parts"."group_export_id" = $1 [["group_export_id", 3]]
=> [#<GroupExportPart:0x00007fc4466a4a98
id: 27,
group_export_id: 3,
status: "created",
jid: nil,
last_error: nil,
name: "attributes",
params: {"group_id"=>7, "tmp_dir_path"=>"twitter/87f95fe227a3118001fd2d3e6b2df3b0"},
created_at: 2019-10-03 15:07:50 UTC,
updated_at: 2019-10-03 15:07:50 UTC>,
...
Migrations output
== 20191003130715 AddGroupExport: migrating ===================================
-- create_table(:group_exports, {:id=>:serial})
-> 0.0057s
-- add_index(:group_exports, [:group_id, :status])
-> 0.0015s
== 20191003130715 AddGroupExport: migrated (0.0072s) ==========================
== 20191003133203 AddGroupExportPart: migrating ===============================
-- create_table(:group_export_parts, {:id=>:serial})
-> 0.0042s
-- add_index(:group_export_parts, [:group_export_id, :status])
-> 0.0017s
== 20191003133203 AddGroupExportPart: migrated (0.0060s) ======================
Screenshots
Does this MR meet the acceptance criteria?
Conformity
Edited by 🤖 GitLab Bot 🤖