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
e3c4947e
Commit
e3c4947e
authored
Sep 21, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add migrations
parent
df51a3d5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
1 deletion
+84
-1
db/migrate/20170921154104_create_board_filters_table.rb
db/migrate/20170921154104_create_board_filters_table.rb
+23
-0
db/migrate/20170921195938_generate_board_filters.rb
db/migrate/20170921195938_generate_board_filters.rb
+19
-0
db/migrate/20170921203824_create_board_filter_labels.rb
db/migrate/20170921203824_create_board_filter_labels.rb
+13
-0
db/schema.rb
db/schema.rb
+29
-1
No files found.
db/migrate/20170921154104_create_board_filters_table.rb
0 → 100644
View file @
e3c4947e
class
CreateBoardFiltersTable
<
ActiveRecord
::
Migration
DOWNTIME
=
false
def
up
create_table
:board_filters
do
|
t
|
t
.
integer
:board_id
,
null:
false
,
index:
true
t
.
integer
:milestone_id
,
index:
true
t
.
integer
:weight
,
index:
true
t
.
integer
:author_id
,
index:
true
t
.
integer
:assignee_id
,
index:
true
end
add_foreign_key
:board_filters
,
:boards
,
column: :board_id
,
on_delete: :cascade
add_foreign_key
:board_filters
,
:milestones
,
column: :milestone_id
,
on_delete: :nullify
add_foreign_key
:board_filters
,
:users
,
column: :author_id
,
on_delete: :nullify
add_foreign_key
:board_filters
,
:users
,
column: :assignee_id
,
on_delete: :nullify
end
def
down
drop_table
:board_filters
end
end
db/migrate/20170921195938_generate_board_filters.rb
0 → 100644
View file @
e3c4947e
class
GenerateBoardFilters
<
ActiveRecord
::
Migration
DOWNTIME
=
false
def
up
# Sub-query executed on production
# https://gitlab.com/gitlab-com/infrastructure/issues/2839#note_41023984
execute
<<-
SQL
INSERT INTO board_filters(board_id, milestone_id)
SELECT id as board_id, milestone_id FROM boards
WHERE (boards.milestone_id IS NOT NULL);
SQL
end
def
down
execute
<<-
SQL
DELETE FROM board_filters;
SQL
end
end
db/migrate/20170921203824_create_board_filter_labels.rb
0 → 100644
View file @
e3c4947e
class
CreateBoardFilterLabels
<
ActiveRecord
::
Migration
DOWNTIME
=
false
def
change
create_table
:board_filter_labels
do
|
t
|
t
.
integer
:board_filter_id
,
null:
false
,
index:
true
t
.
integer
:label_id
,
null:
false
,
index:
true
end
add_foreign_key
:board_filter_labels
,
:board_filters
,
column: :board_filter_id
,
on_delete: :cascade
add_foreign_key
:board_filter_labels
,
:labels
,
column: :label_id
,
on_delete: :cascade
end
end
db/schema.rb
View file @
e3c4947e
...
@@ -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:
201709
18223303
)
do
ActiveRecord
::
Schema
.
define
(
version:
201709
21203824
)
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"
...
@@ -214,6 +214,28 @@ ActiveRecord::Schema.define(version: 20170918223303) do
...
@@ -214,6 +214,28 @@ ActiveRecord::Schema.define(version: 20170918223303) do
add_index
"award_emoji"
,
[
"awardable_type"
,
"awardable_id"
],
name:
"index_award_emoji_on_awardable_type_and_awardable_id"
,
using: :btree
add_index
"award_emoji"
,
[
"awardable_type"
,
"awardable_id"
],
name:
"index_award_emoji_on_awardable_type_and_awardable_id"
,
using: :btree
add_index
"award_emoji"
,
[
"user_id"
,
"name"
],
name:
"index_award_emoji_on_user_id_and_name"
,
using: :btree
add_index
"award_emoji"
,
[
"user_id"
,
"name"
],
name:
"index_award_emoji_on_user_id_and_name"
,
using: :btree
create_table
"board_filter_labels"
,
force: :cascade
do
|
t
|
t
.
integer
"board_filter_id"
,
null:
false
t
.
integer
"label_id"
,
null:
false
end
add_index
"board_filter_labels"
,
[
"board_filter_id"
],
name:
"index_board_filter_labels_on_board_filter_id"
,
using: :btree
add_index
"board_filter_labels"
,
[
"label_id"
],
name:
"index_board_filter_labels_on_label_id"
,
using: :btree
create_table
"board_filters"
,
force: :cascade
do
|
t
|
t
.
integer
"board_id"
,
null:
false
t
.
integer
"milestone_id"
t
.
integer
"weight"
t
.
integer
"author_id"
t
.
integer
"assignee_id"
end
add_index
"board_filters"
,
[
"assignee_id"
],
name:
"index_board_filters_on_assignee_id"
,
using: :btree
add_index
"board_filters"
,
[
"author_id"
],
name:
"index_board_filters_on_author_id"
,
using: :btree
add_index
"board_filters"
,
[
"board_id"
],
name:
"index_board_filters_on_board_id"
,
using: :btree
add_index
"board_filters"
,
[
"milestone_id"
],
name:
"index_board_filters_on_milestone_id"
,
using: :btree
add_index
"board_filters"
,
[
"weight"
],
name:
"index_board_filters_on_weight"
,
using: :btree
create_table
"boards"
,
force: :cascade
do
|
t
|
create_table
"boards"
,
force: :cascade
do
|
t
|
t
.
integer
"project_id"
t
.
integer
"project_id"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"created_at"
,
null:
false
...
@@ -2046,6 +2068,12 @@ ActiveRecord::Schema.define(version: 20170918223303) do
...
@@ -2046,6 +2068,12 @@ ActiveRecord::Schema.define(version: 20170918223303) do
add_foreign_key
"approvals"
,
"merge_requests"
,
name:
"fk_310d714958"
,
on_delete: :cascade
add_foreign_key
"approvals"
,
"merge_requests"
,
name:
"fk_310d714958"
,
on_delete: :cascade
add_foreign_key
"approver_groups"
,
"namespaces"
,
column:
"group_id"
,
on_delete: :cascade
add_foreign_key
"approver_groups"
,
"namespaces"
,
column:
"group_id"
,
on_delete: :cascade
add_foreign_key
"board_filter_labels"
,
"board_filters"
,
on_delete: :cascade
add_foreign_key
"board_filter_labels"
,
"labels"
,
on_delete: :cascade
add_foreign_key
"board_filters"
,
"boards"
,
on_delete: :cascade
add_foreign_key
"board_filters"
,
"milestones"
,
on_delete: :nullify
add_foreign_key
"board_filters"
,
"users"
,
column:
"assignee_id"
,
on_delete: :nullify
add_foreign_key
"board_filters"
,
"users"
,
column:
"author_id"
,
on_delete: :nullify
add_foreign_key
"boards"
,
"namespaces"
,
column:
"group_id"
,
name:
"fk_1e9a074a35"
,
on_delete: :cascade
add_foreign_key
"boards"
,
"namespaces"
,
column:
"group_id"
,
name:
"fk_1e9a074a35"
,
on_delete: :cascade
add_foreign_key
"boards"
,
"projects"
,
name:
"fk_f15266b5f9"
,
on_delete: :cascade
add_foreign_key
"boards"
,
"projects"
,
name:
"fk_f15266b5f9"
,
on_delete: :cascade
add_foreign_key
"chat_teams"
,
"namespaces"
,
on_delete: :cascade
add_foreign_key
"chat_teams"
,
"namespaces"
,
on_delete: :cascade
...
...
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