]> git.openstreetmap.org Git - rails.git/commitdiff
Merge pull request #4289 from grekko/github_workflow_add_annotate_models_check_2
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 18 Oct 2023 13:22:05 +0000 (14:22 +0100)
committerGitHub <noreply@github.com>
Wed, 18 Oct 2023 13:22:05 +0000 (14:22 +0100)
.github/workflows/lint.yml: Check if annotate_models is up to date

15 files changed:
.github/workflows/lint.yml
Gemfile
app/models/changeset_comment.rb
app/models/friendship.rb
app/models/note_comment.rb
app/models/oauth2_application.rb
app/models/oauth_nonce.rb
app/models/old_relation.rb
app/models/old_relation_member.rb
app/models/old_relation_tag.rb
app/models/old_way.rb
app/models/old_way_tag.rb
app/models/tracetag.rb
app/models/user.rb
lib/tasks/auto_annotate_models.rake

index 685937b034ea026708e29bb1edc2ebcb5b02ec4f..cdba19949ef891ffec281613e8ea3aa050d7441f 100644 (file)
@@ -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 724dd3beccac75ba929b6ac55fa144ad97696215..d8d49a1ceb3be104e6522ad2764d3fc274e1c59f 100644 (file)
--- 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
index 1b78f98e8d2da289ddefa3c25262ffc70e790af3..3bc9483fa9c904da8f65df1be3758a17784f6798 100644 (file)
@@ -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
 #
index 476821b47ccdb221b31b603cfa97352611425c86..2b1c7ce00a845d0e85181e50b5c495e718237250 100644 (file)
@@ -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
 #
index 635a5b0def53444f6b5ead14c4d11685a4af6d63..b870e5558e557b2f2c337586206daf5ac6b8c356 100644 (file)
 #
 # 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
 #
index 73a02417da5223802459d4e75c50f1eb2206f92c..834f1ded54393b6d8587f5fbc241f6980bee3b9a 100644 (file)
@@ -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
 
index 86463f297226e11dce96bcc55af1ffd31e92342e..e08121cfc5d53ec7d24dfcf38fcb4847c0ec50e9 100644 (file)
@@ -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
index c36d645728a736907596920e0f8e604357069267..6f122b260873e35af24d432b5db28e7c6f5e666a 100644 (file)
@@ -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
index c99f60e7c95e97d943f42326bf46c40065d45558..b556bd13fd5e0d3ba2c123572e967e510230b0ac 100644 (file)
@@ -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
index c3a1838912cbfb65ccd57492e4c60bfb05214c78..2ed8f988de74677956344cc78537bb4e85688266 100644 (file)
@@ -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
index fcff84ededfe0727120794994b5afc5cdaf04ff6..dabf0aafbbfc24afc0ef566b24234f3fda4ef8b4 100644 (file)
@@ -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
index 0342cf34485c165d2f2ec8ecfd9466f855c7a257..dd8968cb30342f4a5f3582a555c17d34206f9a55 100644 (file)
@@ -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
index 70296cd54f15115c95a4dcac43d01f234539f554..b1dde095c18f7793e524a704f0d7db8550b0f51a 100644 (file)
@@ -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
 #
index 3eb03a2fe4ae93bfb2010b359265f169b8315f79..638928861bd1caed18ac837c0390b115a15b3ce6 100644 (file)
@@ -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
index 70bc391a0ab0672d944dadfa7ad1ec2535babeb8..103e7fcc9aa8312d9d143769264d6c9f71b521be 100644 (file)
@@ -1,7 +1,7 @@
 # NOTE: only doing this in development as some production environments (Heroku)
 # NOTE: are sensitive to local FS writes, and besides -- it's just not proper
 # NOTE: to have a dev-mode tool do its thing in production.
-if Rails.env.development?
+if Rails.env.development? || Rails.env.test?
   task :set_annotation_options => :environment do
     # You can override any of these by setting an environment variable of the
     # same name.