Skip to content

Commit b2bc43e

Browse files
authored
Update active_record_backend.md
The order of operations was wrong in the migration Caused by: ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "graphql_operations" does not exist /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `exec' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `block (2 levels) in execute' /usr/local/bundle/gems/activesupport-7.0.3.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares' /usr/local/bundle/gems/activesupport-7.0.3.1/lib/active_support/dependencies/interlock.rb:41:in `permit_concurrent_loads' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `block in execute' /usr/local/bundle/gems/activesupport-7.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt' /usr/local/bundle/gems/activesupport-7.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize' /usr/local/bundle/gems/activesupport-7.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt' /usr/local/bundle/gems/activesupport-7.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:765:in `block in log' /usr/local/bundle/gems/activesupport-7.0.3.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:756:in `log' /app/config/initializers/multidb_span_logger.rb:14:in `log' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `execute' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:325:in `create_table' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/migration.rb:932:in `block in method_missing' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/migration.rb:900:in `block in say_with_time' /usr/local/bundle/gems/benchmark-0.1.1/lib/benchmark.rb:293:in `measure' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/migration.rb:900:in `say_with_time' /usr/local/bundle/gems/activerecord-7.0.3.1/lib/active_record/migration.rb:921:in `method_missing' /usr/local/bundle/gems/strong_migrations-1.5.0/lib/strong_migrations/migration.rb:17:in `block (2 levels) in method_missing' /usr/local/bundle/gems/strong_migrations-1.5.0/lib/strong_migrations/checker.rb:91:in `perform' /usr/local/bundle/gems/strong_migrations-1.5.0/lib/strong_migrations/migration.rb:16:in `block in method_missing' /usr/local/bundle/gems/strong_migrations-1.5.0/lib/strong_migrations/migration.rb:15:in `catch' /usr/local/bundle/gems/strong_migrations-1.5.0/lib/strong_migrations/migration.rb:15:in `method_missing' /app/app/models/application_migration.rb:6:in `create_table' /app/db/migrate/202xxxxxxxxx_setup_operation_store.rb:11:in `change'
1 parent 805b6b2 commit b2bc43e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

guides/operation_store/active_record_backend.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ def change
3333
add_index :graphql_clients, :name, unique: true
3434
add_index :graphql_clients, :secret, unique: true
3535

36+
create_table :graphql_operations, primary_key: :id do |t|
37+
t.column :digest, :string, null: false
38+
t.column :body, :text, null: false
39+
t.column :name, :string, null: false
40+
t.timestamps
41+
end
42+
add_index :graphql_operations, :digest, unique: true
43+
3644
create_table :graphql_client_operations, primary_key: :id do |t|
3745
t.references :graphql_client, null: false
3846
t.references :graphql_operation, null: false
@@ -44,14 +52,6 @@ def change
4452
add_index :graphql_client_operations, [:graphql_client_id, :alias], unique: true, name: "graphql_client_operations_pairs"
4553
add_index :graphql_client_operations, :is_archived
4654

47-
create_table :graphql_operations, primary_key: :id do |t|
48-
t.column :digest, :string, null: false
49-
t.column :body, :text, null: false
50-
t.column :name, :string, null: false
51-
t.timestamps
52-
end
53-
add_index :graphql_operations, :digest, unique: true
54-
5555
create_table :graphql_index_entries, primary_key: :id do |t|
5656
t.column :name, :string, null: false
5757
end

0 commit comments

Comments
 (0)