Merge branch 'pull/5716'

This commit is contained in:
Anton Khorev 2025-03-01 09:00:22 +03:00
commit f0d19b04f6
44 changed files with 169 additions and 150 deletions

58
.annotaterb.yml Normal file
View file

@ -0,0 +1,58 @@
---
:position: before
:position_in_additional_file_patterns: before
:position_in_class: before
:position_in_factory: before
:position_in_fixture: before
:position_in_routes: before
:position_in_serializer: before
:position_in_test: before
:classified_sort: false
:exclude_controllers: true
:exclude_factories: true
:exclude_fixtures: true
:exclude_helpers: true
:exclude_scaffolds: true
:exclude_serializers: true
:exclude_sti_subclasses: false
:exclude_tests: true
:force: false
:format_markdown: false
:format_rdoc: false
:format_yard: false
:frozen: false
:ignore_model_sub_dir: false
:ignore_unknown_models: false
:include_version: false
:show_check_constraints: false
:show_complete_foreign_keys: false
:show_foreign_keys: true
:show_indexes: true
:simple_indexes: false
:sort: false
:timestamp: false
:trace: false
:with_comment: true
:with_column_comments: true
:with_table_comments: true
:active_admin: false
:command:
:debug: false
:hide_default_column_types: ''
:hide_limit_column_types: 'integer,bigint,boolean'
:ignore_columns:
:ignore_routes:
:models: true
:routes: false
:skip_on_db_migrate: false
:target_action: :do_annotations
:wrapper:
:wrapper_close:
:wrapper_open:
:classes_default_to_s: []
:additional_file_patterns: []
:model_dir:
- app/models
:require: []
:root_dir:
- ''

View file

@ -86,14 +86,17 @@ jobs:
ruby-version: ${{ env.ruby }} ruby-version: ${{ env.ruby }}
rubygems: 3.4.10 rubygems: 3.4.10
bundler-cache: true bundler-cache: true
- name: Configure rails
run: |
cp config/github.database.yml config/database.yml
cp config/example.storage.yml config/storage.yml
- name: Setup database - name: Setup database
run: | run: |
sudo systemctl start postgresql sudo systemctl start postgresql
sudo -u postgres createuser -s $(id -un) sudo -u postgres createuser -s $(id -un)
createdb openstreetmap createdb openstreetmap
cp config/github.database.yml config/database.yml
bundle exec rails db:schema:load bundle exec rails db:schema:load
- name: Run Annotate Models - name: Run Annotate Models
run: bundle exec rails annotate_models run: bundle exec annotaterb models
- name: Fail if model annotations are out of date - name: Fail if model annotations are out of date
run: git diff --exit-code run: git diff --exit-code

View file

@ -176,7 +176,7 @@ group :test do
end end
group :development, :test do group :development, :test do
gem "annotate" gem "annotaterb"
gem "teaspoon" gem "teaspoon"
gem "teaspoon-mocha", "~> 2.3.3" gem "teaspoon-mocha", "~> 2.3.3"

View file

@ -82,9 +82,7 @@ GEM
tzinfo (~> 2.0, >= 2.0.5) tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7) addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0) public_suffix (>= 2.0.2, < 7.0)
annotate (3.2.0) annotaterb (4.14.0)
activerecord (>= 3.2, < 8.0)
rake (>= 10.4, < 14.0)
argon2 (2.3.2) argon2 (2.3.2)
ffi (~> 1.15) ffi (~> 1.15)
ffi-compiler (~> 1.0) ffi-compiler (~> 1.0)
@ -682,7 +680,7 @@ DEPENDENCIES
active_record_union active_record_union
activerecord-import activerecord-import
addressable (~> 2.8) addressable (~> 2.8)
annotate annotaterb
argon2 argon2
autoprefixer-rails autoprefixer-rails
aws-sdk-s3 aws-sdk-s3

View file

@ -2,7 +2,7 @@
# #
# Table name: acls # Table name: acls
# #
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# address :inet # address :inet
# k :string not null # k :string not null
# v :string # v :string

View file

@ -2,8 +2,8 @@
# #
# Table name: changesets # Table name: changesets
# #
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# user_id :bigint(8) not null # user_id :bigint not null
# created_at :datetime not null # created_at :datetime not null
# min_lat :integer # min_lat :integer
# max_lat :integer # max_lat :integer

View file

@ -3,8 +3,8 @@
# Table name: changeset_comments # Table name: changeset_comments
# #
# id :integer not null, primary key # id :integer not null, primary key
# changeset_id :bigint(8) not null # changeset_id :bigint not null
# author_id :bigint(8) not null # author_id :bigint not null
# body :text not null # body :text not null
# created_at :datetime not null # created_at :datetime not null
# visible :boolean not null # visible :boolean not null

View file

@ -2,7 +2,7 @@
# #
# Table name: changeset_tags # Table name: changeset_tags
# #
# changeset_id :bigint(8) not null, primary key # changeset_id :bigint not null, primary key
# k :string default(""), not null, primary key # k :string default(""), not null, primary key
# v :string default(""), not null # v :string default(""), not null
# #

View file

@ -2,9 +2,9 @@
# #
# Table name: diary_comments # Table name: diary_comments
# #
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# diary_entry_id :bigint(8) not null # diary_entry_id :bigint not null
# user_id :bigint(8) not null # user_id :bigint not null
# body :text not null # body :text not null
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null

View file

@ -2,8 +2,8 @@
# #
# Table name: diary_entries # Table name: diary_entries
# #
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# user_id :bigint(8) not null # user_id :bigint not null
# title :string not null # title :string not null
# body :text not null # body :text not null
# created_at :datetime not null # created_at :datetime not null

View file

@ -2,8 +2,8 @@
# #
# Table name: diary_entry_subscriptions # Table name: diary_entry_subscriptions
# #
# user_id :bigint(8) not null, primary key # user_id :bigint not null, primary key
# diary_entry_id :bigint(8) not null, primary key # diary_entry_id :bigint not null, primary key
# #
# Indexes # Indexes
# #

View file

@ -2,9 +2,9 @@
# #
# Table name: friends # Table name: friends
# #
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# user_id :bigint(8) not null # user_id :bigint not null
# friend_user_id :bigint(8) not null # friend_user_id :bigint not null
# created_at :datetime # created_at :datetime
# #
# Indexes # Indexes

View file

@ -2,13 +2,13 @@
# #
# Table name: messages # Table name: messages
# #
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# from_user_id :bigint(8) not null # from_user_id :bigint not null
# title :string not null # title :string not null
# body :text not null # body :text not null
# sent_on :datetime not null # sent_on :datetime not null
# message_read :boolean default(FALSE), not null # message_read :boolean default(FALSE), not null
# to_user_id :bigint(8) not null # to_user_id :bigint not null
# to_user_visible :boolean default(TRUE), not null # to_user_visible :boolean default(TRUE), not null
# from_user_visible :boolean default(TRUE), not null # from_user_visible :boolean default(TRUE), not null
# body_format :enum default("markdown"), not null # body_format :enum default("markdown"), not null

View file

@ -2,14 +2,14 @@
# #
# Table name: current_nodes # Table name: current_nodes
# #
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# latitude :integer not null # latitude :integer not null
# longitude :integer not null # longitude :integer not null
# changeset_id :bigint(8) not null # changeset_id :bigint not null
# visible :boolean not null # visible :boolean not null
# timestamp :datetime not null # timestamp :datetime not null
# tile :bigint(8) not null # tile :bigint not null
# version :bigint(8) not null # version :bigint not null
# #
# Indexes # Indexes
# #

View file

@ -2,7 +2,7 @@
# #
# Table name: current_node_tags # Table name: current_node_tags
# #
# node_id :bigint(8) not null, primary key # node_id :bigint not null, primary key
# k :string default(""), not null, primary key # k :string default(""), not null, primary key
# v :string default(""), not null # v :string default(""), not null
# #

View file

@ -2,16 +2,16 @@
# #
# Table name: notes # Table name: notes
# #
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# latitude :integer not null # latitude :integer not null
# longitude :integer not null # longitude :integer not null
# tile :bigint(8) not null # tile :bigint not null
# updated_at :datetime not null # updated_at :datetime not null
# created_at :datetime not null # created_at :datetime not null
# status :enum not null # status :enum not null
# closed_at :datetime # closed_at :datetime
# description :text default(""), not null # description :text default(""), not null
# user_id :bigint(8) # user_id :bigint
# user_ip :inet # user_ip :inet
# #
# Indexes # Indexes

View file

@ -2,12 +2,12 @@
# #
# Table name: note_comments # Table name: note_comments
# #
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# note_id :bigint(8) not null # note_id :bigint not null
# visible :boolean not null # visible :boolean not null
# created_at :datetime not null # created_at :datetime not null
# author_ip :inet # author_ip :inet
# author_id :bigint(8) # author_id :bigint
# body :text # body :text
# event :enum # event :enum
# #

View file

@ -2,8 +2,8 @@
# #
# Table name: note_subscriptions # Table name: note_subscriptions
# #
# user_id :bigint(8) not null, primary key # user_id :bigint not null, primary key
# note_id :bigint(8) not null, primary key # note_id :bigint not null, primary key
# #
# Indexes # Indexes
# #

View file

@ -2,9 +2,9 @@
# #
# Table name: oauth_applications # Table name: oauth_applications
# #
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# owner_type :string not null # owner_type :string not null
# owner_id :bigint(8) not null # owner_id :bigint not null
# name :string not null # name :string not null
# uid :string not null # uid :string not null
# secret :string not null # secret :string not null

View file

@ -2,14 +2,14 @@
# #
# Table name: nodes # Table name: nodes
# #
# node_id :bigint(8) not null, primary key # node_id :bigint not null, primary key
# latitude :integer not null # latitude :integer not null
# longitude :integer not null # longitude :integer not null
# changeset_id :bigint(8) not null # changeset_id :bigint not null
# visible :boolean not null # visible :boolean not null
# timestamp :datetime not null # timestamp :datetime not null
# tile :bigint(8) not null # tile :bigint not null
# version :bigint(8) not null, primary key # version :bigint not null, primary key
# redaction_id :integer # redaction_id :integer
# #
# Indexes # Indexes

View file

@ -2,14 +2,14 @@
# #
# Table name: node_tags # Table name: node_tags
# #
# node_id :bigint(8) not null, primary key # node_id :bigint not null, primary key
# version :bigint(8) not null, primary key # version :bigint not null, primary key
# k :string default(""), not null, primary key # k :string default(""), not null, primary key
# v :string default(""), not null # v :string default(""), not null
# #
# Foreign Keys # Foreign Keys
# #
# node_tags_id_fkey (["node_id", "version"] => nodes.["node_id", "version"]) # node_tags_id_fkey ([node_id, version] => nodes[node_id, version])
# #
class OldNodeTag < ApplicationRecord class OldNodeTag < ApplicationRecord

View file

@ -2,10 +2,10 @@
# #
# Table name: relations # Table name: relations
# #
# relation_id :bigint(8) not null, primary key # relation_id :bigint not null, primary key
# changeset_id :bigint(8) not null # changeset_id :bigint not null
# timestamp :datetime not null # timestamp :datetime not null
# version :bigint(8) not null, primary key # version :bigint not null, primary key
# visible :boolean default(TRUE), not null # visible :boolean default(TRUE), not null
# redaction_id :integer # redaction_id :integer
# #

View file

@ -2,11 +2,11 @@
# #
# Table name: relation_members # Table name: relation_members
# #
# relation_id :bigint(8) not null, primary key # relation_id :bigint not null, primary key
# member_type :enum not null # member_type :enum not null
# member_id :bigint(8) not null # member_id :bigint not null
# member_role :string not null # member_role :string not null
# version :bigint(8) default(0), not null, primary key # version :bigint default(0), not null, primary key
# sequence_id :integer default(0), not null, primary key # sequence_id :integer default(0), not null, primary key
# #
# Indexes # Indexes
@ -15,7 +15,7 @@
# #
# Foreign Keys # Foreign Keys
# #
# relation_members_id_fkey (["relation_id", "version"] => relations.["relation_id", "version"]) # relation_members_id_fkey ([relation_id, version] => relations[relation_id, version])
# #
class OldRelationMember < ApplicationRecord class OldRelationMember < ApplicationRecord

View file

@ -2,14 +2,14 @@
# #
# Table name: relation_tags # Table name: relation_tags
# #
# relation_id :bigint(8) not null, primary key # relation_id :bigint not null, primary key
# k :string default(""), not null, primary key # k :string default(""), not null, primary key
# v :string default(""), not null # v :string default(""), not null
# version :bigint(8) not null, primary key # version :bigint not null, primary key
# #
# Foreign Keys # Foreign Keys
# #
# relation_tags_id_fkey (["relation_id", "version"] => relations.["relation_id", "version"]) # relation_tags_id_fkey ([relation_id, version] => relations[relation_id, version])
# #
class OldRelationTag < ApplicationRecord class OldRelationTag < ApplicationRecord

View file

@ -2,10 +2,10 @@
# #
# Table name: ways # Table name: ways
# #
# way_id :bigint(8) not null, primary key # way_id :bigint not null, primary key
# changeset_id :bigint(8) not null # changeset_id :bigint not null
# timestamp :datetime not null # timestamp :datetime not null
# version :bigint(8) not null, primary key # version :bigint not null, primary key
# visible :boolean default(TRUE), not null # visible :boolean default(TRUE), not null
# redaction_id :integer # redaction_id :integer
# #

View file

@ -2,10 +2,10 @@
# #
# Table name: way_nodes # Table name: way_nodes
# #
# way_id :bigint(8) not null, primary key # way_id :bigint not null, primary key
# node_id :bigint(8) not null # node_id :bigint not null
# version :bigint(8) not null, primary key # version :bigint not null, primary key
# sequence_id :bigint(8) not null, primary key # sequence_id :bigint not null, primary key
# #
# Indexes # Indexes
# #
@ -13,7 +13,7 @@
# #
# Foreign Keys # Foreign Keys
# #
# way_nodes_id_fkey (["way_id", "version"] => ways.["way_id", "version"]) # way_nodes_id_fkey ([way_id, version] => ways[way_id, version])
# #
class OldWayNode < ApplicationRecord class OldWayNode < ApplicationRecord

View file

@ -2,14 +2,14 @@
# #
# Table name: way_tags # Table name: way_tags
# #
# way_id :bigint(8) not null, primary key # way_id :bigint not null, primary key
# k :string not null, primary key # k :string not null, primary key
# v :string not null # v :string not null
# version :bigint(8) not null, primary key # version :bigint not null, primary key
# #
# Foreign Keys # Foreign Keys
# #
# way_tags_id_fkey (["way_id", "version"] => ways.["way_id", "version"]) # way_tags_id_fkey ([way_id, version] => ways[way_id, version])
# #
class OldWayTag < ApplicationRecord class OldWayTag < ApplicationRecord

View file

@ -7,7 +7,7 @@
# description :text not null # description :text not null
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# user_id :bigint(8) not null # user_id :bigint not null
# description_format :enum default("markdown"), not null # description_format :enum default("markdown"), not null
# #
# Foreign Keys # Foreign Keys

View file

@ -2,11 +2,11 @@
# #
# Table name: current_relations # Table name: current_relations
# #
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# changeset_id :bigint(8) not null # changeset_id :bigint not null
# timestamp :datetime not null # timestamp :datetime not null
# visible :boolean not null # visible :boolean not null
# version :bigint(8) not null # version :bigint not null
# #
# Indexes # Indexes
# #

View file

@ -2,9 +2,9 @@
# #
# Table name: current_relation_members # Table name: current_relation_members
# #
# relation_id :bigint(8) not null, primary key # relation_id :bigint not null, primary key
# member_type :enum not null # member_type :enum not null
# member_id :bigint(8) not null # member_id :bigint not null
# member_role :string not null # member_role :string not null
# sequence_id :integer default(0), not null, primary key # sequence_id :integer default(0), not null, primary key
# #

View file

@ -2,7 +2,7 @@
# #
# Table name: current_relation_tags # Table name: current_relation_tags
# #
# relation_id :bigint(8) not null, primary key # relation_id :bigint not null, primary key
# k :string default(""), not null, primary key # k :string default(""), not null, primary key
# v :string default(""), not null # v :string default(""), not null
# #

View file

@ -2,11 +2,11 @@
# #
# Table name: gpx_files # Table name: gpx_files
# #
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# user_id :bigint(8) not null # user_id :bigint not null
# visible :boolean default(TRUE), not null # visible :boolean default(TRUE), not null
# name :string default(""), not null # name :string default(""), not null
# size :bigint(8) # size :bigint
# latitude :float # latitude :float
# longitude :float # longitude :float
# timestamp :datetime not null # timestamp :datetime not null

View file

@ -6,9 +6,9 @@
# trackid :integer not null # trackid :integer not null
# latitude :integer not null # latitude :integer not null
# longitude :integer not null # longitude :integer not null
# gpx_id :bigint(8) not null # gpx_id :bigint not null
# timestamp :datetime # timestamp :datetime
# tile :bigint(8) # tile :bigint
# #
# Indexes # Indexes
# #

View file

@ -2,9 +2,9 @@
# #
# Table name: gpx_file_tags # Table name: gpx_file_tags
# #
# gpx_id :bigint(8) not null # gpx_id :bigint not null
# tag :string not null # tag :string not null
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# #
# Indexes # Indexes
# #

View file

@ -3,7 +3,7 @@
# Table name: users # Table name: users
# #
# email :string not null # email :string not null
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# pass_crypt :string not null # pass_crypt :string not null
# creation_time :datetime not null # creation_time :datetime not null
# display_name :string default(""), not null # display_name :string default(""), not null
@ -28,7 +28,7 @@
# diary_entries_count :integer default(0), not null # diary_entries_count :integer default(0), not null
# image_use_gravatar :boolean default(FALSE), not null # image_use_gravatar :boolean default(FALSE), not null
# auth_provider :string # auth_provider :string
# home_tile :bigint(8) # home_tile :bigint
# tou_agreed :datetime # tou_agreed :datetime
# diary_comments_count :integer default(0) # diary_comments_count :integer default(0)
# note_comments_count :integer default(0) # note_comments_count :integer default(0)

View file

@ -3,12 +3,12 @@
# Table name: user_blocks # Table name: user_blocks
# #
# id :integer not null, primary key # id :integer not null, primary key
# user_id :bigint(8) not null # user_id :bigint not null
# creator_id :bigint(8) not null # creator_id :bigint not null
# reason :text not null # reason :text not null
# ends_at :datetime not null # ends_at :datetime not null
# needs_view :boolean default(FALSE), not null # needs_view :boolean default(FALSE), not null
# revoker_id :bigint(8) # revoker_id :bigint
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# reason_format :enum default("markdown"), not null # reason_format :enum default("markdown"), not null

View file

@ -2,9 +2,9 @@
# #
# Table name: user_mutes # Table name: user_mutes
# #
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# owner_id :bigint(8) not null # owner_id :bigint not null
# subject_id :bigint(8) not null # subject_id :bigint not null
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# #

View file

@ -2,7 +2,7 @@
# #
# Table name: user_preferences # Table name: user_preferences
# #
# user_id :bigint(8) not null, primary key # user_id :bigint not null, primary key
# k :string not null, primary key # k :string not null, primary key
# v :string not null # v :string not null
# #

View file

@ -3,11 +3,11 @@
# Table name: user_roles # Table name: user_roles
# #
# id :integer not null, primary key # id :integer not null, primary key
# user_id :bigint(8) not null # user_id :bigint not null
# role :enum not null
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# granter_id :bigint(8) not null # role :enum not null
# granter_id :bigint not null
# #
# Indexes # Indexes
# #

View file

@ -2,11 +2,11 @@
# #
# Table name: current_ways # Table name: current_ways
# #
# id :bigint(8) not null, primary key # id :bigint not null, primary key
# changeset_id :bigint(8) not null # changeset_id :bigint not null
# timestamp :datetime not null # timestamp :datetime not null
# visible :boolean not null # visible :boolean not null
# version :bigint(8) not null # version :bigint not null
# #
# Indexes # Indexes
# #

View file

@ -2,9 +2,9 @@
# #
# Table name: current_way_nodes # Table name: current_way_nodes
# #
# way_id :bigint(8) not null, primary key # way_id :bigint not null, primary key
# node_id :bigint(8) not null # node_id :bigint not null
# sequence_id :bigint(8) not null, primary key # sequence_id :bigint not null, primary key
# #
# Indexes # Indexes
# #

View file

@ -2,7 +2,7 @@
# #
# Table name: current_way_tags # Table name: current_way_tags
# #
# way_id :bigint(8) not null, primary key # way_id :bigint not null, primary key
# k :string default(""), not null, primary key # k :string default(""), not null, primary key
# v :string default(""), not null # v :string default(""), not null
# #

View file

@ -0,0 +1,8 @@
# This rake task was added by annotate_rb gem.
# Can set `ANNOTATERB_SKIP_ON_DB_TASKS` to be anything to skip this
if Rails.env.development? && ENV["ANNOTATERB_SKIP_ON_DB_TASKS"].nil?
require "annotate_rb"
AnnotateRb::Core.load_rake_tasks
end

View file

@ -1,48 +0,0 @@
# 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.local?
task :set_annotation_options => :environment do
# You can override any of these by setting an environment variable of the
# same name.
Annotate.set_defaults(
"routes" => "false",
"position_in_routes" => "before",
"position_in_class" => "before",
"position_in_test" => "before",
"position_in_fixture" => "before",
"position_in_factory" => "before",
"position_in_serializer" => "before",
"show_foreign_keys" => "true",
"show_indexes" => "true",
"simple_indexes" => "false",
"model_dir" => "app/models",
"root_dir" => "",
"include_version" => "false",
"require" => "",
"exclude_tests" => "true",
"exclude_fixtures" => "true",
"exclude_factories" => "true",
"exclude_serializers" => "true",
"exclude_scaffolds" => "true",
"exclude_controllers" => "true",
"exclude_helpers" => "true",
"ignore_model_sub_dir" => "false",
"ignore_columns" => nil,
"ignore_routes" => nil,
"ignore_unknown_models" => "false",
"hide_limit_column_types" => "integer,boolean",
"skip_on_db_migrate" => "false",
"format_bare" => "true",
"format_rdoc" => "false",
"format_markdown" => "false",
"sort" => "false",
"force" => "false",
"trace" => "false",
"wrapper_open" => nil,
"wrapper_close" => nil
)
end
Annotate.load_tasks
end