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
5c9874b4
Commit
5c9874b4
authored
Feb 09, 2021
by
Etienne Baqué
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added migration to add new plans
Added migration to add new plans
parent
dd53c00c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
0 deletions
+52
-0
changelogs/unreleased/300546-add-new-plans.yml
changelogs/unreleased/300546-add-new-plans.yml
+5
-0
db/post_migrate/20210205104425_add_new_post_eoa_plans.rb
db/post_migrate/20210205104425_add_new_post_eoa_plans.rb
+14
-0
db/schema_migrations/20210205104425
db/schema_migrations/20210205104425
+1
-0
spec/migrations/add_new_post_eoa_plans_spec.rb
spec/migrations/add_new_post_eoa_plans_spec.rb
+32
-0
No files found.
changelogs/unreleased/300546-add-new-plans.yml
0 → 100644
View file @
5c9874b4
---
title
:
Migration to add new Premium and Ultimate plan records
merge_request
:
53465
author
:
type
:
added
db/post_migrate/20210205104425_add_new_post_eoa_plans.rb
0 → 100644
View file @
5c9874b4
# frozen_string_literal: true
class
AddNewPostEoaPlans
<
ActiveRecord
::
Migration
[
6.0
]
DOWNTIME
=
false
def
up
execute
"INSERT INTO plans (name, title, created_at, updated_at) VALUES ('premium', 'Premium (Formerly Silver)', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)"
execute
"INSERT INTO plans (name, title, created_at, updated_at) VALUES ('ultimate', 'Ultimate (Formerly Gold)', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)"
end
def
down
execute
"DELETE FROM plans WHERE name IN ('premium', 'ultimate')"
end
end
db/schema_migrations/20210205104425
0 → 100644
View file @
5c9874b4
4df2229fca7652cb836c867b621da91f1194899c50bb0a8be2fbae58f29dc788
\ No newline at end of file
spec/migrations/add_new_post_eoa_plans_spec.rb
0 → 100644
View file @
5c9874b4
# frozen_string_literal: true
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20210205104425_add_new_post_eoa_plans.rb'
)
RSpec
.
describe
AddNewPostEoaPlans
do
let
(
:plans
)
{
table
(
:plans
)
}
subject
(
:migration
)
{
described_class
.
new
}
describe
'#up'
do
it
'creates the two new records'
do
expect
{
migration
.
up
}.
to
change
{
plans
.
count
}.
by
(
2
)
new_plans
=
plans
.
last
(
2
)
expect
(
new_plans
.
map
(
&
:name
)).
to
contain_exactly
(
'premium'
,
'ultimate'
)
end
end
describe
'#down'
do
it
'removes these two new records'
do
plans
.
create!
(
name:
'premium'
,
title:
'Premium (Formerly Silver)'
)
plans
.
create!
(
name:
'ultimate'
,
title:
'Ultimate (Formerly Gold)'
)
expect
{
migration
.
down
}.
to
change
{
plans
.
count
}.
by
(
-
2
)
expect
(
plans
.
find_by
(
name:
'premium'
)).
to
be_nil
expect
(
plans
.
find_by
(
name:
'ultimate'
)).
to
be_nil
end
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