debian-mirror-gitlab/doc/development/mass_insert.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
791 B
Markdown
Raw Normal View History

2021-01-29 00:20:46 +05:30
---
stage: none
group: unassigned
2021-02-22 17:27:13 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2021-01-29 00:20:46 +05:30
---
2020-05-24 23:13:21 +05:30
# Mass inserting Rails models
2020-01-01 13:55:28 +05:30
2020-05-24 23:13:21 +05:30
Setting the environment variable [`MASS_INSERT=1`](rake_tasks.md#environment-variables)
2021-02-22 17:27:13 +05:30
when running [`rake setup`](rake_tasks.md) creates millions of records, but these records
2020-01-01 13:55:28 +05:30
aren't visible to the `root` user by default.
To make any number of the mass-inserted projects visible to the `root` user, run
the following snippet in the rails console.
```ruby
u = User.find(1)
2020-04-08 14:13:33 +05:30
Project.last(100).each { |p| p.set_timestamps_for_create && p.add_maintainer(u, current_user: u) } # Change 100 to whatever number of projects you need access to
2020-01-01 13:55:28 +05:30
```