这是indexloc提供的服务,不要输入任何密码
Skip to content

Migration fail on AddStatusToUnits with latest dump #819

@Kint0ki

Description

@Kint0ki

Executing migrations on latest dump gives error on migration AddStatusToUnits.

Caused by:
ActiveRecord::StatementInvalid: PG::SyntaxError: ERROR:  zero-length delimited identifier at or near """" (ActiveRecord::StatementInvalid)
LINE 1: ...hapters"."id" FROM "chapters" ORDER BY "chapters"."" ASC LIM...
                                                             ^

Description:

Steps to reproduce:

  1. Download dump and import.
  2. Run bin/rails db:migrate RAILS_ENV=development
  3. Error, see trace below.
Trace
[dotenv] Loaded .env
W, [2024-11-10T19:19:48.848614 #71]  WARN -- : Creating scope :open. Overwriting existing method Group.open.
Running via Spring preloader in process 89
W, [2024-11-10T19:19:50.425591 #89]  WARN -- : DEPRECATION WARNING: PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from /usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql_adapter.rb:883:in `new'
 (called from <main> at /opt/kitsu/server/bin/rake:7)
D, [2024-11-10T19:19:50.450520 #89] DEBUG -- : DEBUG: Chewy strategies stack: [2] <- bypass @ /usr/local/bundle/gems/chewy-0.9.0/lib/chewy/railtie.rb:35
D, [2024-11-10T19:19:50.458960 #89] DEBUG -- :    (2.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
I, [2024-11-10T19:19:50.459875 #89]  INFO -- : Migrating to AddStatusToUnits (20241027084222)
D, [2024-11-10T19:19:50.513616 #89] DEBUG -- : DEBUG: Chewy strategies stack: [3] <- bypass @ /usr/local/bundle/gems/chewy-0.9.0/lib/chewy/railtie.rb:35
== 20241027084222 AddStatusToUnits: migrating =================================
-- add_column(:chapters, :status, :integer)
D, [2024-11-10T19:19:50.516296 #89] DEBUG -- :   TRANSACTION (0.7ms)  BEGIN
D, [2024-11-10T19:19:50.655851 #89] DEBUG -- :    (139.3ms)  ALTER TABLE "chapters" ADD "status" integer
   -> 0.1411s
-- add_column(:episodes, :status, :integer)
D, [2024-11-10T19:19:50.659913 #89] DEBUG -- :    (3.5ms)  ALTER TABLE "episodes" ADD "status" integer
   -> 0.0039s
D, [2024-11-10T19:19:50.670652 #89] DEBUG -- :   Chapter Exists? (0.3ms)  SELECT 1 AS one FROM "chapters" LIMIT 1
D, [2024-11-10T19:19:50.672171 #89] DEBUG -- :    (1.2ms)  SELECT "chapters"."id" FROM "chapters" ORDER BY "chapters"."" ASC LIMIT 1 OFFSET 9999
D, [2024-11-10T19:19:50.672358 #89] DEBUG -- : DEBUG: Chewy strategies stack: [3] -> bypass @ /usr/local/bundle/gems/chewy-0.9.0/lib/chewy/railtie.rb:35
D, [2024-11-10T19:19:50.672749 #89] DEBUG -- :   TRANSACTION (0.1ms)  ROLLBACK
D, [2024-11-10T19:19:50.672976 #89] DEBUG -- : DEBUG: Chewy strategies stack: [2] -> bypass @ /usr/local/bundle/gems/chewy-0.9.0/lib/chewy/railtie.rb:35
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)

PG::SyntaxError: ERROR:  zero-length delimited identifier at or near """"
LINE 1: ...hapters"."id" FROM "chapters" ORDER BY "chapters"."" ASC LIM...
                                                             ^
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql_adapter.rb:672:in `exec_params'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql_adapter.rb:672:in `block (2 levels) in exec_no_cache'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `block in exec_no_cache'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract_adapter.rb:696:in `block (2 levels) in log'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract_adapter.rb:695:in `block in log'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract_adapter.rb:687:in `log'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql_adapter.rb:670:in `exec_no_cache'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql_adapter.rb:649:in `execute_and_clear'
/usr/local/bundle/gems/marginalia-1.11.1/lib/marginalia.rb:91:in `execute_and_clear_with_marginalia'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:55:in `exec_query'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/database_statements.rb:532:in `select'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/database_statements.rb:69:in `select_all'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/query_cache.rb:103:in `select_all'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/relation/calculations.rb:200:in `block in pluck'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/relation.rb:861:in `skip_query_cache_if_necessary'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/relation/calculations.rb:196:in `pluck'
/opt/kitsu/server/lib/update_in_batches.rb:17:in `block in update_in_batches'
/opt/kitsu/server/lib/update_in_batches.rb:13:in `loop'
/opt/kitsu/server/lib/update_in_batches.rb:13:in `update_in_batches'
/opt/kitsu/server/db/migrate/20241027084222_add_status_to_units.rb:7:in `change'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:867:in `exec_migration'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:851:in `block (2 levels) in migrate'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:850:in `block in migrate'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:849:in `migrate'
/usr/local/bundle/gems/chewy-0.9.0/lib/chewy/railtie.rb:35:in `block in migrate'
/usr/local/bundle/gems/chewy-0.9.0/lib/chewy/strategy.rb:63:in `wrap'
/usr/local/bundle/gems/chewy-0.9.0/lib/chewy.rb:187:in `strategy'
/usr/local/bundle/gems/chewy-0.9.0/lib/chewy/railtie.rb:35:in `migrate'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1037:in `migrate'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1329:in `block in execute_migration_in_transaction'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1380:in `block in ddl_transaction'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/transactions.rb:209:in `transaction'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1380:in `ddl_transaction'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1328:in `execute_migration_in_transaction'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1302:in `each'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1253:in `migrate'
/usr/local/bundle/gems/chewy-0.9.0/lib/chewy/railtie.rb:35:in `block in migrate'
/usr/local/bundle/gems/chewy-0.9.0/lib/chewy/strategy.rb:63:in `wrap'
/usr/local/bundle/gems/chewy-0.9.0/lib/chewy.rb:187:in `strategy'
/usr/local/bundle/gems/chewy-0.9.0/lib/chewy/railtie.rb:35:in `migrate'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1086:in `up'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/migration.rb:1061:in `migrate'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:90:in `each'
/usr/local/bundle/gems/activerecord-6.1.7.6/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/usr/local/bundle/gems/sentry-ruby-5.15.2/lib/sentry/rake.rb:26:in `execute'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/fork_tracker.rb:10:in `block in fork'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/fork_tracker.rb:10:in `block in fork'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/fork_tracker.rb:8:in `fork'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/fork_tracker.rb:8:in `fork'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/fork_tracker.rb:27:in `fork'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/fork_tracker.rb:8:in `fork'
/usr/local/bundle/gems/activesupport-6.1.7.6/lib/active_support/fork_tracker.rb:27:in `fork'
<internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
<internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
-e:1:in `<main>'

Screenshots (if applicable):

N/A

OS and Browser:

N/A


Sidenote:

Latest dump only has schema_migrations up to 20240928225045 (FillOriginalAndRomanizedTitlesOnMedia), so has the dump not been updated for a while, or have all subsequent migrations not been executed/registered due to the current migration failure (?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions