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
4e93c384
Commit
4e93c384
authored
Jan 07, 2020
by
celdem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add timestamp to software license policy
parent
a1b5260e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
0 deletions
+40
-0
db/migrate/20200107172020_add_timestamp_softwarelicensespolicy.rb
...te/20200107172020_add_timestamp_softwarelicensespolicy.rb
+15
-0
db/schema.rb
db/schema.rb
+2
-0
spec/migrations/20200107172020_add_timestamp_softwarelicensespolicy_spec.rb
...200107172020_add_timestamp_softwarelicensespolicy_spec.rb
+23
-0
No files found.
db/migrate/20200107172020_add_timestamp_softwarelicensespolicy.rb
0 → 100644
View file @
4e93c384
# frozen_string_literal: true
class
AddTimestampSoftwarelicensespolicy
<
ActiveRecord
::
Migration
[
5.2
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
up
add_timestamps_with_timezone
(
:software_license_policies
,
null:
true
)
end
def
down
remove_timestamps
(
:software_license_policies
)
end
end
db/schema.rb
View file @
4e93c384
...
...
@@ -3824,6 +3824,8 @@ ActiveRecord::Schema.define(version: 2020_01_08_100603) do
t
.
integer
"project_id"
,
null:
false
t
.
integer
"software_license_id"
,
null:
false
t
.
integer
"classification"
,
default:
0
,
null:
false
t
.
datetime_with_timezone
"created_at"
t
.
datetime_with_timezone
"updated_at"
t
.
index
[
"project_id"
,
"software_license_id"
],
name:
"index_software_license_policies_unique_per_project"
,
unique:
true
t
.
index
[
"software_license_id"
],
name:
"index_software_license_policies_on_software_license_id"
end
...
...
spec/migrations/20200107172020_add_timestamp_softwarelicensespolicy_spec.rb
0 → 100644
View file @
4e93c384
# frozen_string_literal: true
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'migrate'
,
'20200107172020_add_timestamp_softwarelicensespolicy.rb'
)
describe
AddTimestampSoftwarelicensespolicy
,
:migration
do
let
(
:software_licenses_policy
)
{
table
(
:software_license_policies
)
}
let
(
:projects
)
{
table
(
:projects
)
}
let
(
:licenses
)
{
table
(
:software_licenses
)
}
before
do
projects
.
create!
(
name:
'gitlab'
,
path:
'gitlab-org/gitlab-ce'
,
namespace_id:
1
)
licenses
.
create!
(
name:
'MIT'
)
software_licenses_policy
.
create!
(
project_id:
projects
.
first
.
id
,
software_license_id:
licenses
.
first
.
id
)
end
it
'creates timestamps'
do
migrate!
expect
(
software_licenses_policy
.
first
.
created_at
).
to
be_nil
expect
(
software_licenses_policy
.
first
.
updated_at
).
to
be_nil
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