Skip to content

Commit

Permalink
Add foreign keys without validation (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
bensheldon committed Jun 11, 2022
1 parent 27d296c commit cbaaa6b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions db/migrate/20220611143549_add_foreign_keys.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class AddForeignKeys < ActiveRecord::Migration[6.1]
def change
add_foreign_key :service_definitions, :cities, on_delete: :cascade, validate: false
add_foreign_key :service_requests, :cities, on_delete: :cascade, validate: false
add_foreign_key :statuses, :cities, on_delete: :cascade, validate: false
end
end
6 changes: 5 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2022_06_11_013909) do
ActiveRecord::Schema.define(version: 2022_06_11_143549) do

# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
enable_extension "pgcrypto"
Expand Down Expand Up @@ -107,6 +108,9 @@
t.index ["created_at"], name: "index_statuses_on_created_at"
end

add_foreign_key "service_definitions", "cities", on_delete: :cascade
add_foreign_key "service_requests", "cities", on_delete: :cascade
add_foreign_key "statuses", "cities", on_delete: :cascade

create_view "global_indices", materialized: true, sql_definition: <<-SQL
WITH service_request_indices AS (
Expand Down

0 comments on commit cbaaa6b

Please sign in to comment.