Skip to content

Commit 2c47a25

Browse files
committed
style(db): auto-correct rubocop offenses in database files
- Add frozen_string_literal comments - Fix indentation and spacing - Standardize migration formatting
1 parent b6ec188 commit 2c47a25

26 files changed

Lines changed: 945 additions & 895 deletions

config/initializers/cors.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
Rails.application.config.middleware.insert_before 0, Rack::Cors do
1111
allow do
12-
origins ENV.fetch('CORS_ORIGINS', 'http://localhost:5173').split(',')
12+
origins ENV.fetch('CORS_ORIGINS', 'http://localhost:5173,http://localhost:8888').split(',')
1313

1414
resource '*',
1515
headers: :any,
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
class EnableUuidExtension < ActiveRecord::Migration[7.1]
2-
def change
3-
enable_extension 'pgcrypto'
4-
end
5-
end
1+
# frozen_string_literal: true
2+
3+
class EnableUuidExtension < ActiveRecord::Migration[7.1]
4+
def change
5+
enable_extension 'pgcrypto'
6+
end
7+
end
Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
class CreateOrganizations < ActiveRecord::Migration[7.1]
2-
def change
3-
create_table :organizations, id: :uuid do |t|
4-
t.string :name, null: false
5-
t.string :slug, null: false
6-
t.string :region, null: false
7-
t.string :tier
8-
t.string :subscription_plan
9-
t.string :subscription_status
10-
t.string :logo_url
11-
t.jsonb :settings, default: {}
12-
13-
t.timestamps
14-
end
15-
16-
add_index :organizations, :slug, unique: true
17-
add_index :organizations, :region
18-
add_index :organizations, :subscription_plan
19-
end
20-
end
1+
# frozen_string_literal: true
2+
3+
class CreateOrganizations < ActiveRecord::Migration[7.1]
4+
def change
5+
create_table :organizations, id: :uuid do |t|
6+
t.string :name, null: false
7+
t.string :slug, null: false
8+
t.string :region, null: false
9+
t.string :tier
10+
t.string :subscription_plan
11+
t.string :subscription_status
12+
t.string :logo_url
13+
t.jsonb :settings, default: {}
14+
15+
t.timestamps
16+
end
17+
18+
add_index :organizations, :slug, unique: true
19+
add_index :organizations, :region
20+
add_index :organizations, :subscription_plan
21+
end
22+
end
Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
class CreateUsers < ActiveRecord::Migration[7.1]
2-
def change
3-
create_table :users, id: :uuid do |t|
4-
t.references :organization, null: false, foreign_key: true, type: :uuid
5-
t.string :email, null: false
6-
t.string :password_digest, null: false
7-
t.string :full_name
8-
t.string :role, null: false
9-
t.string :avatar_url
10-
t.string :timezone
11-
t.string :language
12-
t.boolean :notifications_enabled, default: true
13-
t.jsonb :notification_preferences, default: {}
14-
t.timestamp :last_login_at
15-
16-
t.timestamps
17-
end
18-
19-
add_index :users, :email, unique: true
20-
add_index :users, :role
21-
end
22-
end
1+
# frozen_string_literal: true
2+
3+
class CreateUsers < ActiveRecord::Migration[7.1]
4+
def change
5+
create_table :users, id: :uuid do |t|
6+
t.references :organization, null: false, foreign_key: true, type: :uuid
7+
t.string :email, null: false
8+
t.string :password_digest, null: false
9+
t.string :full_name
10+
t.string :role, null: false
11+
t.string :avatar_url
12+
t.string :timezone
13+
t.string :language
14+
t.boolean :notifications_enabled, default: true
15+
t.jsonb :notification_preferences, default: {}
16+
t.timestamp :last_login_at
17+
18+
t.timestamps
19+
end
20+
21+
add_index :users, :email, unique: true
22+
add_index :users, :role
23+
end
24+
end
Lines changed: 61 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,61 @@
1-
class CreatePlayers < ActiveRecord::Migration[7.1]
2-
def change
3-
create_table :players, id: :uuid do |t|
4-
t.references :organization, null: false, foreign_key: true, type: :uuid
5-
t.string :summoner_name, null: false
6-
t.string :real_name
7-
t.string :role, null: false
8-
t.string :country
9-
t.date :birth_date
10-
t.string :status, default: 'active'
11-
12-
# Riot Games Data
13-
t.string :riot_puuid
14-
t.string :riot_summoner_id
15-
t.string :riot_account_id
16-
t.integer :profile_icon_id
17-
t.integer :summoner_level
18-
19-
# Ranked Data
20-
t.string :solo_queue_tier
21-
t.string :solo_queue_rank
22-
t.integer :solo_queue_lp
23-
t.integer :solo_queue_wins
24-
t.integer :solo_queue_losses
25-
t.string :flex_queue_tier
26-
t.string :flex_queue_rank
27-
t.integer :flex_queue_lp
28-
t.string :peak_tier
29-
t.string :peak_rank
30-
t.string :peak_season
31-
32-
# Contract Info
33-
t.date :contract_start_date
34-
t.date :contract_end_date
35-
t.decimal :salary, precision: 10, scale: 2
36-
t.integer :jersey_number
37-
38-
# Additional Info
39-
t.text :champion_pool, array: true, default: []
40-
t.string :preferred_role_secondary
41-
t.text :playstyle_tags, array: true, default: []
42-
t.string :twitter_handle
43-
t.string :twitch_channel
44-
t.string :instagram_handle
45-
t.text :notes
46-
47-
# Metadata
48-
t.jsonb :metadata, default: {}
49-
t.timestamp :last_sync_at
50-
51-
t.timestamps
52-
end
53-
54-
add_index :players, :riot_puuid, unique: true
55-
add_index :players, :summoner_name
56-
add_index :players, :status
57-
add_index :players, :role
58-
end
59-
end
1+
# frozen_string_literal: true
2+
3+
class CreatePlayers < ActiveRecord::Migration[7.1]
4+
def change
5+
create_table :players, id: :uuid do |t|
6+
t.references :organization, null: false, foreign_key: true, type: :uuid
7+
t.string :summoner_name, null: false
8+
t.string :real_name
9+
t.string :role, null: false
10+
t.string :country
11+
t.date :birth_date
12+
t.string :status, default: 'active'
13+
14+
# Riot Games Data
15+
t.string :riot_puuid
16+
t.string :riot_summoner_id
17+
t.string :riot_account_id
18+
t.integer :profile_icon_id
19+
t.integer :summoner_level
20+
21+
# Ranked Data
22+
t.string :solo_queue_tier
23+
t.string :solo_queue_rank
24+
t.integer :solo_queue_lp
25+
t.integer :solo_queue_wins
26+
t.integer :solo_queue_losses
27+
t.string :flex_queue_tier
28+
t.string :flex_queue_rank
29+
t.integer :flex_queue_lp
30+
t.string :peak_tier
31+
t.string :peak_rank
32+
t.string :peak_season
33+
34+
# Contract Info
35+
t.date :contract_start_date
36+
t.date :contract_end_date
37+
t.decimal :salary, precision: 10, scale: 2
38+
t.integer :jersey_number
39+
40+
# Additional Info
41+
t.text :champion_pool, array: true, default: []
42+
t.string :preferred_role_secondary
43+
t.text :playstyle_tags, array: true, default: []
44+
t.string :twitter_handle
45+
t.string :twitch_channel
46+
t.string :instagram_handle
47+
t.text :notes
48+
49+
# Metadata
50+
t.jsonb :metadata, default: {}
51+
t.timestamp :last_sync_at
52+
53+
t.timestamps
54+
end
55+
56+
add_index :players, :riot_puuid, unique: true
57+
add_index :players, :summoner_name
58+
add_index :players, :status
59+
add_index :players, :role
60+
end
61+
end
Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,55 @@
1-
class CreateMatches < ActiveRecord::Migration[7.1]
2-
def change
3-
create_table :matches, id: :uuid do |t|
4-
t.references :organization, null: false, foreign_key: true, type: :uuid
5-
t.string :match_type, null: false
6-
t.string :riot_match_id
7-
8-
# Game Info
9-
t.string :game_version
10-
t.timestamp :game_start
11-
t.timestamp :game_end
12-
t.integer :game_duration
13-
14-
# Teams
15-
t.string :our_side
16-
t.string :opponent_name
17-
t.string :opponent_tag
18-
t.boolean :victory
19-
20-
# Scores
21-
t.integer :our_score
22-
t.integer :opponent_score
23-
t.integer :our_towers
24-
t.integer :opponent_towers
25-
t.integer :our_dragons
26-
t.integer :opponent_dragons
27-
t.integer :our_barons
28-
t.integer :opponent_barons
29-
t.integer :our_inhibitors
30-
t.integer :opponent_inhibitors
31-
32-
# Bans
33-
t.text :our_bans, array: true, default: []
34-
t.text :opponent_bans, array: true, default: []
35-
36-
# Files
37-
t.string :vod_url
38-
t.string :replay_file_url
39-
40-
# Organization
41-
t.text :tags, array: true, default: []
42-
t.text :notes
43-
t.jsonb :metadata, default: {}
44-
45-
t.timestamps
46-
end
47-
48-
add_index :matches, :riot_match_id, unique: true
49-
add_index :matches, :match_type
50-
add_index :matches, :game_start
51-
add_index :matches, :victory
52-
end
53-
end
1+
# frozen_string_literal: true
2+
3+
class CreateMatches < ActiveRecord::Migration[7.1]
4+
def change
5+
create_table :matches, id: :uuid do |t|
6+
t.references :organization, null: false, foreign_key: true, type: :uuid
7+
t.string :match_type, null: false
8+
t.string :riot_match_id
9+
10+
# Game Info
11+
t.string :game_version
12+
t.timestamp :game_start
13+
t.timestamp :game_end
14+
t.integer :game_duration
15+
16+
# Teams
17+
t.string :our_side
18+
t.string :opponent_name
19+
t.string :opponent_tag
20+
t.boolean :victory
21+
22+
# Scores
23+
t.integer :our_score
24+
t.integer :opponent_score
25+
t.integer :our_towers
26+
t.integer :opponent_towers
27+
t.integer :our_dragons
28+
t.integer :opponent_dragons
29+
t.integer :our_barons
30+
t.integer :opponent_barons
31+
t.integer :our_inhibitors
32+
t.integer :opponent_inhibitors
33+
34+
# Bans
35+
t.text :our_bans, array: true, default: []
36+
t.text :opponent_bans, array: true, default: []
37+
38+
# Files
39+
t.string :vod_url
40+
t.string :replay_file_url
41+
42+
# Organization
43+
t.text :tags, array: true, default: []
44+
t.text :notes
45+
t.jsonb :metadata, default: {}
46+
47+
t.timestamps
48+
end
49+
50+
add_index :matches, :riot_match_id, unique: true
51+
add_index :matches, :match_type
52+
add_index :matches, :game_start
53+
add_index :matches, :victory
54+
end
55+
end

0 commit comments

Comments
 (0)