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
bcb5f8a2
Commit
bcb5f8a2
authored
Mar 02, 2020
by
Jan Provaznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated DB migration
* reordered columns * moved fks to separate migrations
parent
9bffa830
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
11 deletions
+51
-11
db/migrate/20200226100614_create_requirements.rb
db/migrate/20200226100614_create_requirements.rb
+7
-5
db/migrate/20200226100624_requirements_add_project_fk.rb
db/migrate/20200226100624_requirements_add_project_fk.rb
+19
-0
db/migrate/20200226100634_requirements_add_author_fk.rb
db/migrate/20200226100634_requirements_add_author_fk.rb
+19
-0
db/schema.rb
db/schema.rb
+6
-6
No files found.
db/migrate/20200226100614_create_requirements.rb
View file @
bcb5f8a2
...
@@ -7,16 +7,18 @@ class CreateRequirements < ActiveRecord::Migration[6.0]
...
@@ -7,16 +7,18 @@ class CreateRequirements < ActiveRecord::Migration[6.0]
def
change
def
change
create_table
:requirements
do
|
t
|
create_table
:requirements
do
|
t
|
t
.
integer
:state
,
limit:
2
,
default:
1
,
null:
false
t
.
timestamps_with_timezone
null:
false
t
.
integer
:project_id
,
null:
false
t
.
integer
:author_id
t
.
integer
:iid
,
null:
false
t
.
integer
:iid
,
null:
false
t
.
integer
:cached_markdown_version
t
.
integer
:cached_markdown_version
t
.
references
:project
,
null:
false
,
index:
true
,
foreign_key:
{
on_delete: :cascade
}
t
.
integer
:state
,
limit:
2
,
default:
1
,
null:
false
t
.
references
:author
,
index:
true
,
foreign_key:
{
to_table: :users
,
on_delete: :nullify
}
t
.
timestamps_with_timezone
null:
false
t
.
string
:title
,
limit:
255
,
null:
false
t
.
string
:title
,
limit:
255
,
null:
false
t
.
text
:title_html
t
.
text
:title_html
t
.
index
:title
t
.
index
:project_id
t
.
index
:author_id
t
.
index
:title
,
name:
"index_requirements_on_title_trigram"
,
using: :gin
,
opclass: :gin_trgm_ops
t
.
index
:state
t
.
index
:state
t
.
index
:created_at
t
.
index
:created_at
t
.
index
:updated_at
t
.
index
:updated_at
...
...
db/migrate/20200226100624_requirements_add_project_fk.rb
0 → 100644
View file @
bcb5f8a2
# frozen_string_literal: true
class
RequirementsAddProjectFk
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
up
with_lock_retries
do
add_foreign_key
(
:requirements
,
:projects
,
column: :project_id
,
on_delete: :cascade
)
# rubocop: disable Migration/AddConcurrentForeignKey
end
end
def
down
with_lock_retries
do
remove_foreign_key
(
:requirements
,
column: :project_id
)
end
end
end
db/migrate/20200226100634_requirements_add_author_fk.rb
0 → 100644
View file @
bcb5f8a2
# frozen_string_literal: true
class
RequirementsAddAuthorFk
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
up
with_lock_retries
do
add_foreign_key
(
:requirements
,
:users
,
column: :author_id
,
on_delete: :nullify
)
# rubocop: disable Migration/AddConcurrentForeignKey
end
end
def
down
with_lock_retries
do
remove_foreign_key
(
:requirements
,
column: :author_id
)
end
end
end
db/schema.rb
View file @
bcb5f8a2
...
@@ -3723,13 +3723,13 @@ ActiveRecord::Schema.define(version: 2020_02_27_165129) do
...
@@ -3723,13 +3723,13 @@ ActiveRecord::Schema.define(version: 2020_02_27_165129) do
end
end
create_table
"requirements"
,
force: :cascade
do
|
t
|
create_table
"requirements"
,
force: :cascade
do
|
t
|
t
.
integer
"state"
,
limit:
2
,
default:
1
,
null:
false
t
.
integer
"iid"
,
null:
false
t
.
integer
"cached_markdown_version"
t
.
bigint
"project_id"
,
null:
false
t
.
bigint
"author_id"
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"created_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
integer
"project_id"
,
null:
false
t
.
integer
"author_id"
t
.
integer
"iid"
,
null:
false
t
.
integer
"cached_markdown_version"
t
.
integer
"state"
,
limit:
2
,
default:
1
,
null:
false
t
.
string
"title"
,
limit:
255
,
null:
false
t
.
string
"title"
,
limit:
255
,
null:
false
t
.
text
"title_html"
t
.
text
"title_html"
t
.
index
[
"author_id"
],
name:
"index_requirements_on_author_id"
t
.
index
[
"author_id"
],
name:
"index_requirements_on_author_id"
...
@@ -3737,7 +3737,7 @@ ActiveRecord::Schema.define(version: 2020_02_27_165129) do
...
@@ -3737,7 +3737,7 @@ ActiveRecord::Schema.define(version: 2020_02_27_165129) do
t
.
index
[
"project_id"
,
"iid"
],
name:
"index_requirements_on_project_id_and_iid"
,
unique:
true
,
where:
"(project_id IS NOT NULL)"
t
.
index
[
"project_id"
,
"iid"
],
name:
"index_requirements_on_project_id_and_iid"
,
unique:
true
,
where:
"(project_id IS NOT NULL)"
t
.
index
[
"project_id"
],
name:
"index_requirements_on_project_id"
t
.
index
[
"project_id"
],
name:
"index_requirements_on_project_id"
t
.
index
[
"state"
],
name:
"index_requirements_on_state"
t
.
index
[
"state"
],
name:
"index_requirements_on_state"
t
.
index
[
"title"
],
name:
"index_requirements_on_title
"
t
.
index
[
"title"
],
name:
"index_requirements_on_title
_trigram"
,
opclass: :gin_trgm_ops
,
using: :gin
t
.
index
[
"updated_at"
],
name:
"index_requirements_on_updated_at"
t
.
index
[
"updated_at"
],
name:
"index_requirements_on_updated_at"
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