BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
20160328115649_migrate_new_notification_setting.rb
...igrate/20160328115649_migrate_new_notification_setting.rb
+13
-0
20160328121138_add_notification_setting_index.rb
db/migrate/20160328121138_add_notification_setting_index.rb
+6
-0
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 @@
#
# 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
enable_extension
"plpgsql"
...
...
@@ -647,6 +647,9 @@ ActiveRecord::Schema.define(version: 20160328112808) do
t
.
datetime
"updated_at"
,
null:
false
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
|
t
.
integer
"resource_owner_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