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
Jérome Perrin
gitlab-ce
Commits
63c7801e
Commit
63c7801e
authored
Apr 04, 2017
by
Douwe Maan
Committed by
Luke "Jared" Bennett
Apr 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove and ignore notes.original_discussion_id column
parent
c319f211
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
2 deletions
+55
-2
app/models/concerns/ignorable_column.rb
app/models/concerns/ignorable_column.rb
+28
-0
app/models/note.rb
app/models/note.rb
+3
-0
db/post_migrate/20170404170532_remove_notes_original_discussion_id.rb
...ate/20170404170532_remove_notes_original_discussion_id.rb
+23
-0
db/schema.rb
db/schema.rb
+1
-2
No files found.
app/models/concerns/ignorable_column.rb
0 → 100644
View file @
63c7801e
# Module that can be included into a model to make it easier to ignore database
# columns.
#
# Example:
#
# class User < ActiveRecord::Base
# include IgnorableColumn
#
# ignore_column :updated_at
# end
#
module
IgnorableColumn
extend
ActiveSupport
::
Concern
module
ClassMethods
def
columns
super
.
reject
{
|
column
|
ignored_columns
.
include?
(
column
.
name
)
}
end
def
ignored_columns
@ignored_columns
||=
Set
.
new
end
def
ignore_column
(
name
)
ignored_columns
<<
name
.
to_s
end
end
end
app/models/note.rb
View file @
63c7801e
...
@@ -9,6 +9,9 @@ class Note < ActiveRecord::Base
...
@@ -9,6 +9,9 @@ class Note < ActiveRecord::Base
include
CacheMarkdownField
include
CacheMarkdownField
include
AfterCommitQueue
include
AfterCommitQueue
include
ResolvableNote
include
ResolvableNote
include
IgnorableColumn
ignore_column
:original_discussion_id
cache_markdown_field
:note
,
pipeline: :note
cache_markdown_field
:note
,
pipeline: :note
...
...
db/post_migrate/20170404170532_remove_notes_original_discussion_id.rb
0 → 100644
View file @
63c7801e
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
RemoveNotesOriginalDiscussionId
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
# existing transaction. When using "add_concurrent_index" make sure that this
# method is the _only_ method called in the migration, any other changes
# should go in a separate migration. This ensures that upon failure _only_ the
# index creation fails and can be retried or reverted easily.
#
# To disable transactions uncomment the following line and remove these
# comments:
# disable_ddl_transaction!
def
change
remove_column
:notes
,
:original_discussion_id
,
:string
end
end
db/schema.rb
View file @
63c7801e
...
@@ -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:
2017040
2231018
)
do
ActiveRecord
::
Schema
.
define
(
version:
2017040
4170532
)
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"
...
@@ -724,7 +724,6 @@ ActiveRecord::Schema.define(version: 20170402231018) do
...
@@ -724,7 +724,6 @@ ActiveRecord::Schema.define(version: 20170402231018) do
t
.
datetime
"resolved_at"
t
.
datetime
"resolved_at"
t
.
integer
"resolved_by_id"
t
.
integer
"resolved_by_id"
t
.
string
"discussion_id"
t
.
string
"discussion_id"
t
.
string
"original_discussion_id"
t
.
text
"note_html"
t
.
text
"note_html"
end
end
...
...
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