Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit e85ed51

Browse files
committed
Increased the text storage for vulnerabilities
Some images like `node:8` had so many vulnerabilities that then the stored JSON was huge. This is a temporary fix because we are about to release 2.3 and this fix is needed. A more suitable approach is the one mentioned in #1669. Fixes #1657 Signed-off-by: Miquel Sabaté Solà <[email protected]>
1 parent 588a37b commit e85ed51

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

app/models/tag.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# marked :boolean default(FALSE)
1616
# username :string(255)
1717
# scanned :integer default(0)
18-
# vulnerabilities :text(65535)
18+
# vulnerabilities :text(16777215)
1919
#
2020
# Indexes
2121
#
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class ChangeVulnerabilitiesToMediumText < ActiveRecord::Migration
2+
def change
3+
change_column :tags, :vulnerabilities, :text, limit: 16.megabytes - 1
4+
end
5+
end

db/schema.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# It's strongly recommended that you check this file into your version control system.
1313

14-
ActiveRecord::Schema.define(version: 20180109114124) do
14+
ActiveRecord::Schema.define(version: 20180207145522) do
1515

1616
create_table "activities", force: :cascade do |t|
1717
t.integer "trackable_id", limit: 4
@@ -109,17 +109,17 @@
109109
add_index "stars", ["user_id"], name: "index_stars_on_user_id", using: :btree
110110

111111
create_table "tags", force: :cascade do |t|
112-
t.string "name", limit: 255, default: "latest", null: false
113-
t.integer "repository_id", limit: 4, null: false
114-
t.datetime "created_at", null: false
115-
t.datetime "updated_at", null: false
112+
t.string "name", limit: 255, default: "latest", null: false
113+
t.integer "repository_id", limit: 4, null: false
114+
t.datetime "created_at", null: false
115+
t.datetime "updated_at", null: false
116116
t.integer "user_id", limit: 4
117117
t.string "digest", limit: 255
118-
t.string "image_id", limit: 255, default: ""
119-
t.boolean "marked", default: false
118+
t.string "image_id", limit: 255, default: ""
119+
t.boolean "marked", default: false
120120
t.string "username", limit: 255
121-
t.integer "scanned", limit: 4, default: 0
122-
t.text "vulnerabilities", limit: 65535
121+
t.integer "scanned", limit: 4, default: 0
122+
t.text "vulnerabilities", limit: 16777215
123123
end
124124

125125
add_index "tags", ["repository_id"], name: "index_tags_on_repository_id", using: :btree

spec/controllers/tags_controller_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# marked :boolean default(FALSE)
1616
# username :string(255)
1717
# scanned :integer default(0)
18-
# vulnerabilities :text(65535)
18+
# vulnerabilities :text(16777215)
1919
#
2020
# Indexes
2121
#

spec/models/tag_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# marked :boolean default(FALSE)
1616
# username :string(255)
1717
# scanned :integer default(0)
18-
# vulnerabilities :text(65535)
18+
# vulnerabilities :text(16777215)
1919
#
2020
# Indexes
2121
#

0 commit comments

Comments
 (0)