Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
03570415
Commit
03570415
authored
Mar 12, 2020
by
Pavel Shutsin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove obsolete bot_type column
users.bot_type column is removed in favor of users.user_type
parent
4e5e26a0
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
6 deletions
+38
-6
app/models/user.rb
app/models/user.rb
+1
-2
changelogs/unreleased/208897-remove-bot-type-column.yml
changelogs/unreleased/208897-remove-bot-type-column.yml
+5
-0
config/pseudonymizer.yml
config/pseudonymizer.yml
+0
-1
db/post_migrate/20200508091106_remove_bot_type.rb
db/post_migrate/20200508091106_remove_bot_type.rb
+29
-0
db/structure.sql
db/structure.sql
+1
-3
lib/gitlab/background_migration/populate_user_highest_roles_table.rb
...background_migration/populate_user_highest_roles_table.rb
+2
-0
No files found.
app/models/user.rb
View file @
03570415
...
@@ -65,8 +65,7 @@ class User < ApplicationRecord
...
@@ -65,8 +65,7 @@ class User < ApplicationRecord
MINIMUM_INACTIVE_DAYS
=
180
MINIMUM_INACTIVE_DAYS
=
180
ignore_column
:bot_type
,
remove_with:
'12.11'
,
remove_after:
'2020-04-22'
ignore_column
:bot_type
,
remove_with:
'13.1'
,
remove_after:
'2020-05-22'
ignore_column
:ghost
,
remove_with:
'13.2'
,
remove_after:
'2020-06-22'
ignore_column
:ghost
,
remove_with:
'13.2'
,
remove_after:
'2020-06-22'
# Override Devise::Models::Trackable#update_tracked_fields!
# Override Devise::Models::Trackable#update_tracked_fields!
...
...
changelogs/unreleased/208897-remove-bot-type-column.yml
0 → 100644
View file @
03570415
---
title
:
Remove obsolete bot_type column
merge_request
:
27076
author
:
type
:
other
config/pseudonymizer.yml
View file @
03570415
...
@@ -469,7 +469,6 @@ tables:
...
@@ -469,7 +469,6 @@ tables:
-
last_activity_on
-
last_activity_on
-
notified_of_own_activity
-
notified_of_own_activity
-
user_type
-
user_type
-
bot_type
-
preferred_language
-
preferred_language
-
theme_id
-
theme_id
db/post_migrate/20200508091106_remove_bot_type.rb
0 → 100644
View file @
03570415
# frozen_string_literal: true
class
RemoveBotType
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
remove_concurrent_index_by_name
:users
,
'index_users_on_bot_type'
with_lock_retries
do
remove_column
:users
,
:bot_type
end
end
def
down
unless
column_exists?
(
:users
,
:bot_type
)
with_lock_retries
do
add_column
:users
,
:bot_type
,
:integer
,
limit:
2
# rubocop:disable Migration/AddColumnsToWideTables
end
end
execute
'UPDATE users set bot_type = user_type WHERE user_type IN(1,2,3,6)'
add_concurrent_index
:users
,
:bot_type
end
end
db/structure.sql
View file @
03570415
...
@@ -6778,7 +6778,6 @@ CREATE TABLE public.users (
...
@@ -6778,7 +6778,6 @@ CREATE TABLE public.users (
commit_email
character
varying
,
commit_email
character
varying
,
group_view
integer
,
group_view
integer
,
managing_group_id
integer
,
managing_group_id
integer
,
bot_type
smallint
,
first_name
character
varying
(
255
),
first_name
character
varying
(
255
),
last_name
character
varying
(
255
),
last_name
character
varying
(
255
),
static_object_token
character
varying
(
255
),
static_object_token
character
varying
(
255
),
...
@@ -10732,8 +10731,6 @@ CREATE INDEX index_users_on_accepted_term_id ON public.users USING btree (accept
...
@@ -10732,8 +10731,6 @@ CREATE INDEX index_users_on_accepted_term_id ON public.users USING btree (accept
CREATE
INDEX
index_users_on_admin
ON
public
.
users
USING
btree
(
admin
);
CREATE
INDEX
index_users_on_admin
ON
public
.
users
USING
btree
(
admin
);
CREATE
INDEX
index_users_on_bot_type
ON
public
.
users
USING
btree
(
bot_type
);
CREATE
UNIQUE
INDEX
index_users_on_confirmation_token
ON
public
.
users
USING
btree
(
confirmation_token
);
CREATE
UNIQUE
INDEX
index_users_on_confirmation_token
ON
public
.
users
USING
btree
(
confirmation_token
);
CREATE
INDEX
index_users_on_created_at
ON
public
.
users
USING
btree
(
created_at
);
CREATE
INDEX
index_users_on_created_at
ON
public
.
users
USING
btree
(
created_at
);
...
@@ -13765,6 +13762,7 @@ COPY "schema_migrations" (version) FROM STDIN;
...
@@ -13765,6 +13762,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200506085748
20200506085748
20200506125731
20200506125731
20200507221434
20200507221434
20200508091106
20200511145545
20200511145545
\
.
\
.
lib/gitlab/background_migration/populate_user_highest_roles_table.rb
View file @
03570415
...
@@ -20,6 +20,8 @@ module Gitlab
...
@@ -20,6 +20,8 @@ module Gitlab
end
end
def
perform
(
from_id
,
to_id
)
def
perform
(
from_id
,
to_id
)
return
unless
User
.
column_names
.
include?
(
'bot_type'
)
(
from_id
..
to_id
).
each_slice
(
BATCH_SIZE
)
do
|
ids
|
(
from_id
..
to_id
).
each_slice
(
BATCH_SIZE
)
do
|
ids
|
execute
(
execute
(
<<-
EOF
<<-
EOF
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment