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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
73c5a341
Commit
73c5a341
authored
Mar 28, 2016
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate notification setting from members table
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
31b0e530
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
db/migrate/20160328115649_migrate_new_notification_setting.rb
...igrate/20160328115649_migrate_new_notification_setting.rb
+13
-0
db/migrate/20160328121138_add_notification_setting_index.rb
db/migrate/20160328121138_add_notification_setting_index.rb
+6
-0
db/schema.rb
db/schema.rb
+4
-1
No files found.
db/migrate/20160328115649_migrate_new_notification_setting.rb
0 → 100644
View file @
73c5a341
# This migration will create one row of NotificationSetting for each Member row
# It can take long time on big instances. Its unclear yet if this migration can be done online.
# This comment should be updated by @dzaporozhets before 8.7 release. If not - please ask him to do so.
class
MigrateNewNotificationSetting
<
ActiveRecord
::
Migration
def
up
timestamp
=
Time
.
now
execute
"INSERT INTO notification_settings ( user_id, source_id, source_type, level, created_at, updated_at ) SELECT user_id, source_id, source_type, notification_level, '
#{
timestamp
}
', '
#{
timestamp
}
' FROM members"
end
def
down
NotificationSetting
.
delete_all
end
end
db/migrate/20160328121138_add_notification_setting_index.rb
0 → 100644
View file @
73c5a341
class
AddNotificationSettingIndex
<
ActiveRecord
::
Migration
def
change
add_index
:notification_settings
,
:user_id
add_index
:notification_settings
,
[
:source_id
,
:source_type
]
end
end
db/schema.rb
View file @
73c5a341
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201603281
1280
8
)
do
ActiveRecord
::
Schema
.
define
(
version:
201603281
2113
8
)
do
# These are extensions that must be enabled in order to support this database
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
enable_extension
"plpgsql"
...
@@ -647,6 +647,9 @@ ActiveRecord::Schema.define(version: 20160328112808) do
...
@@ -647,6 +647,9 @@ ActiveRecord::Schema.define(version: 20160328112808) do
t
.
datetime
"updated_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
end
end
add_index
"notification_settings"
,
[
"source_id"
,
"source_type"
],
name:
"index_notification_settings_on_source_id_and_source_type"
,
using: :btree
add_index
"notification_settings"
,
[
"user_id"
],
name:
"index_notification_settings_on_user_id"
,
using: :btree
create_table
"oauth_access_grants"
,
force: :cascade
do
|
t
|
create_table
"oauth_access_grants"
,
force: :cascade
do
|
t
|
t
.
integer
"resource_owner_id"
,
null:
false
t
.
integer
"resource_owner_id"
,
null:
false
t
.
integer
"application_id"
,
null:
false
t
.
integer
"application_id"
,
null:
false
...
...
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