Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add foreign keys without validation #176

Merged
merged 1 commit into from Jun 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions db/migrate/20220611143549_add_foreign_keys.rb
@@ -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
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