Skip to content

Commit 9154ac4

Browse files
committed
Adds 'archived' column to repos table
1 parent c81a900 commit 9154ac4

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

app/models/repo.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ def update_from_github
209209
language: fetcher_json.fetch('language', language),
210210
description: fetcher_json.fetch('description', description)&.first(255),
211211
full_name: repo_full_name,
212-
removed_from_github: false
212+
removed_from_github: false,
213+
archived: fetcher_json.fetch('archived', archived)
213214
)
214215
end
215216
end
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class AddArchivedColumnToRepo < ActiveRecord::Migration[7.0]
2+
def change
3+
add_column :repos, :archived, :boolean, default: false
4+
add_index :repos, :archived
5+
end
6+
end

db/schema.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[7.0].define(version: 2022_10_10_011048) do
13+
ActiveRecord::Schema[7.0].define(version: 2022_10_13_212959) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pg_stat_statements"
1616
enable_extension "plpgsql"
@@ -155,6 +155,8 @@
155155
t.integer "subscribers_count", default: 0
156156
t.integer "docs_subscriber_count", default: 0
157157
t.boolean "removed_from_github", default: false
158+
t.boolean "archived", default: false
159+
t.index ["archived"], name: "index_repos_on_archived"
158160
t.index ["full_name"], name: "index_repos_on_full_name"
159161
t.index ["issues_count"], name: "index_repos_on_issues_count"
160162
t.index ["language"], name: "index_repos_on_language"

test/jobs/update_repo_info_job_test.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class UpdateRepoInfoJobTest < ActiveJob::TestCase
2626
{
2727
'full_name' => 'test_owner/test_repo',
2828
'language' => 'test_language',
29-
'description' => 'test_description'
29+
'description' => 'test_description',
30+
'archived' => true
3031
}
3132
)
3233
repo = repos(:node)
@@ -37,6 +38,7 @@ class UpdateRepoInfoJobTest < ActiveJob::TestCase
3738
repo.user_name,
3839
repo.language,
3940
repo.description,
41+
repo.archived
4042
]
4143
} do
4244
UpdateRepoInfoJob.perform_now(repo)
@@ -48,6 +50,7 @@ class UpdateRepoInfoJobTest < ActiveJob::TestCase
4850
assert_equal 'test_owner', repo.user_name
4951
assert_equal 'test_language', repo.language
5052
assert_equal 'test_description', repo.description
53+
assert_equal true, repo.archived
5154
end
5255

5356
test 'repo rename conflict' do
@@ -65,6 +68,7 @@ class UpdateRepoInfoJobTest < ActiveJob::TestCase
6568
repo.user_name,
6669
repo.language,
6770
repo.description,
71+
repo.archived
6872
]
6973
} do
7074
UpdateRepoInfoJob.perform_now(repo)

0 commit comments

Comments
 (0)