Skip to content

Commit

Permalink
Add scm_token column to tokens table
Browse files Browse the repository at this point in the history
  • Loading branch information
Dany Marcoux authored and vpereira committed Apr 30, 2021
1 parent 4ea55da commit 4210c34
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 16 deletions.
8 changes: 5 additions & 3 deletions src/api/app/models/token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,18 @@ def package_find_options
# Table name: tokens
#
# id :integer not null, primary key
# scm_token :string(255) indexed
# string :string(255) indexed
# type :string(255)
# package_id :integer indexed
# user_id :integer not null, indexed
#
# Indexes
#
# index_tokens_on_string (string) UNIQUE
# package_id (package_id)
# user_id (user_id)
# index_tokens_on_scm_token (scm_token)
# index_tokens_on_string (string) UNIQUE
# package_id (package_id)
# user_id (user_id)
#
# Foreign Keys
#
Expand Down
8 changes: 5 additions & 3 deletions src/api/app/models/token/rebuild.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ def package_find_options
# Table name: tokens
#
# id :integer not null, primary key
# scm_token :string(255) indexed
# string :string(255) indexed
# type :string(255)
# package_id :integer indexed
# user_id :integer not null, indexed
#
# Indexes
#
# index_tokens_on_string (string) UNIQUE
# package_id (package_id)
# user_id (user_id)
# index_tokens_on_scm_token (scm_token)
# index_tokens_on_string (string) UNIQUE
# package_id (package_id)
# user_id (user_id)
#
# Foreign Keys
#
Expand Down
8 changes: 5 additions & 3 deletions src/api/app/models/token/release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ def package_find_options
# Table name: tokens
#
# id :integer not null, primary key
# scm_token :string(255) indexed
# string :string(255) indexed
# type :string(255)
# package_id :integer indexed
# user_id :integer not null, indexed
#
# Indexes
#
# index_tokens_on_string (string) UNIQUE
# package_id (package_id)
# user_id (user_id)
# index_tokens_on_scm_token (scm_token)
# index_tokens_on_string (string) UNIQUE
# package_id (package_id)
# user_id (user_id)
#
# Foreign Keys
#
Expand Down
8 changes: 5 additions & 3 deletions src/api/app/models/token/rss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ def self.token_name
# Table name: tokens
#
# id :integer not null, primary key
# scm_token :string(255) indexed
# string :string(255) indexed
# type :string(255)
# package_id :integer indexed
# user_id :integer not null, indexed
#
# Indexes
#
# index_tokens_on_string (string) UNIQUE
# package_id (package_id)
# user_id (user_id)
# index_tokens_on_scm_token (scm_token)
# index_tokens_on_string (string) UNIQUE
# package_id (package_id)
# user_id (user_id)
#
# Foreign Keys
#
Expand Down
8 changes: 5 additions & 3 deletions src/api/app/models/token/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ def package_find_options
# Table name: tokens
#
# id :integer not null, primary key
# scm_token :string(255) indexed
# string :string(255) indexed
# type :string(255)
# package_id :integer indexed
# user_id :integer not null, indexed
#
# Indexes
#
# index_tokens_on_string (string) UNIQUE
# package_id (package_id)
# user_id (user_id)
# index_tokens_on_scm_token (scm_token)
# index_tokens_on_string (string) UNIQUE
# package_id (package_id)
# user_id (user_id)
#
# Foreign Keys
#
Expand Down
10 changes: 10 additions & 0 deletions src/api/db/migrate/20210428122525_add_scm_token_to_tokens.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class AddScmTokenToTokens < ActiveRecord::Migration[6.0]
def change
safety_assured do # since strong_migrations cannot look inside the block of change_table
change_table :tokens, bulk: true do |t|
t.string :scm_token
t.index :scm_token
end
end
end
end
4 changes: 3 additions & 1 deletion src/api/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2021_04_28_112249) do
ActiveRecord::Schema.define(version: 2021_04_28_122525) do

create_table "architectures", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC", force: :cascade do |t|
t.string "name", null: false, collation: "utf8_general_ci"
Expand Down Expand Up @@ -1005,7 +1005,9 @@
t.integer "user_id", null: false
t.integer "package_id"
t.string "type", collation: "utf8_unicode_ci"
t.string "scm_token"
t.index ["package_id"], name: "package_id"
t.index ["scm_token"], name: "index_tokens_on_scm_token"
t.index ["string"], name: "index_tokens_on_string", unique: true
t.index ["user_id"], name: "user_id"
end
Expand Down

0 comments on commit 4210c34

Please sign in to comment.