From: Andy Allan Date: Wed, 18 Oct 2023 14:41:01 +0000 (+0100) Subject: Merge pull request #4279 from tomhughes/changeset-tags-primary-key X-Git-Tag: live~1442 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/4c4150e0d0dc43c0468388956728d8ffc43e6c9c?hp=387ecce798585022ffac69d28ae703c737c36f3b Merge pull request #4279 from tomhughes/changeset-tags-primary-key Add a primary key to the changeset_tags table --- diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 685937b03..cdba19949 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -72,3 +72,27 @@ jobs: bundler-cache: true - name: Run brakeman run: bundle exec brakeman -q + annotate_models: + env: + RAILS_ENV: test + name: Rails Annotate Models + runs-on: ubuntu-22.04 + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ env.ruby }} + bundler-cache: true + - name: Setup database + run: | + sudo systemctl start postgresql + sudo -u postgres createuser -s $(id -un) + createdb openstreetmap + cp config/github.database.yml config/database.yml + bundle exec rails db:test:load + - name: Run Annotate Models + run: bundle exec rails annotate_models + - name: Fail if model annotations are out of date + run: git diff --exit-code diff --git a/Gemfile b/Gemfile index 724dd3bec..d8d49a1ce 100644 --- a/Gemfile +++ b/Gemfile @@ -136,7 +136,6 @@ gem "image_processing" # Gems useful for development group :development do - gem "annotate" gem "better_errors" gem "binding_of_caller" gem "debug_inspector" @@ -167,3 +166,7 @@ group :test do gem "simplecov-lcov", :require => false gem "webmock" end + +group :development, :test do + gem "annotate" +end diff --git a/Gemfile.lock b/Gemfile.lock index c8784ed7c..cbad137e1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -95,8 +95,8 @@ GEM autoprefixer-rails (10.4.15.0) execjs (~> 2) aws-eventstream (1.2.0) - aws-partitions (1.831.0) - aws-sdk-core (3.185.0) + aws-partitions (1.836.0) + aws-sdk-core (3.185.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) @@ -171,7 +171,7 @@ GEM deep_merge (1.2.2) delayed_job (4.1.11) activesupport (>= 3.0, < 8.0) - delayed_job_active_record (4.1.7) + delayed_job_active_record (4.1.8) activerecord (>= 3.0, < 8.0) delayed_job (>= 3.0, < 5) docile (1.4.0) @@ -234,7 +234,7 @@ GEM faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-net_http (3.0.2) - ffi (1.16.2) + ffi (1.16.3) ffi-compiler (1.0.1) ffi (>= 1.0.0) rake @@ -247,7 +247,7 @@ GEM ffi (>= 1.0.0) globalid (1.2.1) activesupport (>= 6.1) - google-protobuf (3.24.3) + google-protobuf (3.24.4) hashdiff (1.0.1) hashie (5.0.0) highline (2.1.0) @@ -257,14 +257,14 @@ GEM concurrent-ruby (~> 1.0) i18n-js (3.9.2) i18n (>= 0.6.6) - i18n-tasks (1.0.12) + i18n-tasks (1.0.13) activesupport (>= 4.0.2) ast (>= 2.1.0) better_html (>= 1.0, < 3.0) erubi highline (>= 2.0.0) i18n - parser (>= 2.2.3.0) + parser (>= 3.2.2.1) rails-i18n rainbow (>= 2.2.2, < 4.0) terminal-table (>= 1.5.1) @@ -304,7 +304,7 @@ GEM logstasher (2.1.5) activesupport (>= 5.2) request_store - loofah (2.21.3) + loofah (2.21.4) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -323,7 +323,7 @@ GEM msgpack (1.7.2) multi_json (1.15.0) multi_xml (0.6.0) - net-imap (0.3.7) + net-imap (0.4.1) date net-protocol net-pop (0.1.2) @@ -383,7 +383,7 @@ GEM omniauth (~> 2.0) openstreetmap-deadlock_retry (1.3.1) parallel (1.23.0) - parser (3.2.2.3) + parser (3.2.2.4) ast (~> 2.4.1) racc pg (1.5.4) @@ -446,19 +446,19 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - regexp_parser (2.8.1) + regexp_parser (2.8.2) request_store (1.5.1) rack (>= 1.4) rexml (3.2.6) rinku (2.0.6) rotp (6.3.0) rouge (4.1.3) - rubocop (1.56.4) + rubocop (1.57.1) base64 (~> 0.1.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.3) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) @@ -495,7 +495,7 @@ GEM google-protobuf (~> 3.23) rake (>= 13.0.0) secure_headers (6.5.0) - selenium-webdriver (4.13.1) + selenium-webdriver (4.14.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 6ff46c07c..73226a518 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -109,31 +109,14 @@ header { float: left; } - a, a:hover { - text-decoration: none; - } - img.logo { - width: 30px; - height: 30px; margin-top: -2px; - vertical-align: middle; } h1 { font-size: 18px; - font-weight: 600; line-height: 1.2; - margin: 0; padding-top: 15px; - - a { - color: #000; - } - - a:hover { - color: #000; - } } .btn { @@ -187,22 +170,6 @@ nav.secondary { color: darken($darkgrey, 25%); } - .login-menu { - .btn-outline-secondary { - @include button-outline-variant($darkgrey, $color-hover: $white, $active-color: $white); - } - } - - .user-menu { - .btn-outline-secondary { - @include button-outline-variant($darkgrey, $color-hover: $darkgrey, $active-background: white, $active-border: $darkgrey); - border-color: $grey; - &:hover { - border-color: $grey; - } - } - } - #inboxanchor { background-color: lighten($grey, 10%); } diff --git a/app/models/changeset_comment.rb b/app/models/changeset_comment.rb index 1b78f98e8..3bc9483fa 100644 --- a/app/models/changeset_comment.rb +++ b/app/models/changeset_comment.rb @@ -11,7 +11,9 @@ # # Indexes # -# index_changeset_comments_on_created_at (created_at) +# index_changeset_comments_on_author_id_and_created_at (author_id,created_at) +# index_changeset_comments_on_changeset_id_and_created_at (changeset_id,created_at) +# index_changeset_comments_on_created_at (created_at) # # Foreign Keys # diff --git a/app/models/friendship.rb b/app/models/friendship.rb index 476821b47..2b1c7ce00 100644 --- a/app/models/friendship.rb +++ b/app/models/friendship.rb @@ -5,11 +5,12 @@ # id :bigint(8) not null, primary key # user_id :bigint(8) not null # friend_user_id :bigint(8) not null +# created_at :datetime # # Indexes # -# friends_user_id_idx (user_id) -# user_id_idx (friend_user_id) +# index_friends_on_user_id_and_created_at (user_id,created_at) +# user_id_idx (friend_user_id) # # Foreign Keys # diff --git a/app/models/note_comment.rb b/app/models/note_comment.rb index 635a5b0de..b870e5558 100644 --- a/app/models/note_comment.rb +++ b/app/models/note_comment.rb @@ -13,9 +13,10 @@ # # Indexes # -# index_note_comments_on_body (to_tsvector('english'::regconfig, body)) USING gin -# index_note_comments_on_created_at (created_at) -# note_comments_note_id_idx (note_id) +# index_note_comments_on_author_id_and_created_at (author_id,created_at) +# index_note_comments_on_body (to_tsvector('english'::regconfig, body)) USING gin +# index_note_comments_on_created_at (created_at) +# note_comments_note_id_idx (note_id) # # Foreign Keys # diff --git a/app/models/oauth2_application.rb b/app/models/oauth2_application.rb index 73a02417d..834f1ded5 100644 --- a/app/models/oauth2_application.rb +++ b/app/models/oauth2_application.rb @@ -1,3 +1,28 @@ +# == Schema Information +# +# Table name: oauth_applications +# +# id :bigint(8) not null, primary key +# owner_type :string not null +# owner_id :bigint(8) not null +# name :string not null +# uid :string not null +# secret :string not null +# redirect_uri :text not null +# scopes :string default(""), not null +# confidential :boolean default(TRUE), not null +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_oauth_applications_on_owner_type_and_owner_id (owner_type,owner_id) +# index_oauth_applications_on_uid (uid) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (owner_id => users.id) +# class Oauth2Application < Doorkeeper::Application belongs_to :owner, :polymorphic => true diff --git a/app/models/oauth_nonce.rb b/app/models/oauth_nonce.rb index 86463f297..e08121cfc 100644 --- a/app/models/oauth_nonce.rb +++ b/app/models/oauth_nonce.rb @@ -2,7 +2,7 @@ # # Table name: oauth_nonces # -# id :bigint not null, primary key +# id :bigint(8) not null, primary key # nonce :string # timestamp :integer # created_at :datetime diff --git a/app/models/old_relation.rb b/app/models/old_relation.rb index c36d64572..6f122b260 100644 --- a/app/models/old_relation.rb +++ b/app/models/old_relation.rb @@ -2,7 +2,7 @@ # # Table name: relations # -# relation_id :bigint(8) default(0), not null, primary key +# relation_id :bigint(8) not null, primary key # changeset_id :bigint(8) not null # timestamp :datetime not null # version :bigint(8) not null, primary key diff --git a/app/models/old_relation_member.rb b/app/models/old_relation_member.rb index c99f60e7c..b556bd13f 100644 --- a/app/models/old_relation_member.rb +++ b/app/models/old_relation_member.rb @@ -2,7 +2,7 @@ # # Table name: relation_members # -# relation_id :bigint(8) default(0), not null, primary key +# relation_id :bigint(8) not null, primary key # member_type :enum not null # member_id :bigint(8) not null # member_role :string not null diff --git a/app/models/old_relation_tag.rb b/app/models/old_relation_tag.rb index c3a183891..2ed8f988d 100644 --- a/app/models/old_relation_tag.rb +++ b/app/models/old_relation_tag.rb @@ -2,7 +2,7 @@ # # Table name: relation_tags # -# relation_id :bigint(8) default(0), not null, primary key +# relation_id :bigint(8) not null, primary key # k :string default(""), not null, primary key # v :string default(""), not null # version :bigint(8) not null, primary key diff --git a/app/models/old_way.rb b/app/models/old_way.rb index fcff84ede..dabf0aafb 100644 --- a/app/models/old_way.rb +++ b/app/models/old_way.rb @@ -2,7 +2,7 @@ # # Table name: ways # -# way_id :bigint(8) default(0), not null, primary key +# way_id :bigint(8) not null, primary key # changeset_id :bigint(8) not null # timestamp :datetime not null # version :bigint(8) not null, primary key diff --git a/app/models/old_way_tag.rb b/app/models/old_way_tag.rb index 0342cf344..dd8968cb3 100644 --- a/app/models/old_way_tag.rb +++ b/app/models/old_way_tag.rb @@ -2,7 +2,7 @@ # # Table name: way_tags # -# way_id :bigint(8) default(0), not null, primary key +# way_id :bigint(8) not null, primary key # k :string not null, primary key # v :string not null # version :bigint(8) not null, primary key diff --git a/app/models/tracetag.rb b/app/models/tracetag.rb index 70296cd54..b1dde095c 100644 --- a/app/models/tracetag.rb +++ b/app/models/tracetag.rb @@ -2,7 +2,7 @@ # # Table name: gpx_file_tags # -# gpx_id :bigint(8) default(0), not null +# gpx_id :bigint(8) not null # tag :string not null # id :bigint(8) not null, primary key # diff --git a/app/models/user.rb b/app/models/user.rb index 3eb03a2fe..638928861 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -12,7 +12,6 @@ # home_lat :float # home_lon :float # home_zoom :integer default(3) -# nearby :integer default(50) # pass_salt :string # email_valid :boolean default(FALSE), not null # new_email :string diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 8ff04536d..fb5c01839 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,7 +1,7 @@
-

- - <%= image_tag "osm_logo.png", :srcset => image_path("osm_logo.svg"), :alt => t("layouts.logo.alt_text"), :class => "logo" %> +

+ + <%= image_tag "osm_logo.png", :srcset => image_path("osm_logo.svg"), :alt => t("layouts.logo.alt_text"), :width => 30, :height => 30, :class => "logo" %> <%= t "layouts.project_name.h1" %>

@@ -60,7 +60,7 @@ <%= link_to t("layouts.about"), about_path, :class => "nav-link" %>