Fix antenna fabricator tests and move duplicate check to db
This commit is contained in:
parent
e656ab15a1
commit
df0b1a4632
8 changed files with 34 additions and 19 deletions
17
db/migrate/20230822041804_add_antenna_elements_uniqueness.rb
Normal file
17
db/migrate/20230822041804_add_antenna_elements_uniqueness.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddAntennaElementsUniqueness < ActiveRecord::Migration[7.0]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
safety_assured do
|
||||
add_index :antenna_accounts, [:antenna_id, :account_id], unique: true
|
||||
add_index :antenna_domains, [:antenna_id, :name], unique: true
|
||||
add_index :antenna_tags, [:antenna_id, :tag_id], unique: true
|
||||
end
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_08_21_061713) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_08_22_041804) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
|
@ -262,6 +262,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_08_21_061713) do
|
|||
t.datetime "created_at", precision: nil, null: false
|
||||
t.datetime "updated_at", precision: nil, null: false
|
||||
t.index ["account_id"], name: "index_antenna_accounts_on_account_id"
|
||||
t.index ["antenna_id", "account_id"], name: "index_antenna_accounts_on_antenna_id_and_account_id", unique: true
|
||||
t.index ["antenna_id"], name: "index_antenna_accounts_on_antenna_id"
|
||||
t.index ["exclude"], name: "index_antenna_accounts_on_exclude"
|
||||
end
|
||||
|
@ -272,6 +273,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_08_21_061713) do
|
|||
t.boolean "exclude", default: false, null: false
|
||||
t.datetime "created_at", precision: nil, null: false
|
||||
t.datetime "updated_at", precision: nil, null: false
|
||||
t.index ["antenna_id", "name"], name: "index_antenna_domains_on_antenna_id_and_name", unique: true
|
||||
t.index ["antenna_id"], name: "index_antenna_domains_on_antenna_id"
|
||||
t.index ["exclude"], name: "index_antenna_domains_on_exclude"
|
||||
t.index ["name"], name: "index_antenna_domains_on_name"
|
||||
|
@ -283,6 +285,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_08_21_061713) do
|
|||
t.boolean "exclude", default: false, null: false
|
||||
t.datetime "created_at", precision: nil, null: false
|
||||
t.datetime "updated_at", precision: nil, null: false
|
||||
t.index ["antenna_id", "tag_id"], name: "index_antenna_tags_on_antenna_id_and_tag_id", unique: true
|
||||
t.index ["antenna_id"], name: "index_antenna_tags_on_antenna_id"
|
||||
t.index ["exclude"], name: "index_antenna_tags_on_exclude"
|
||||
t.index ["tag_id"], name: "index_antenna_tags_on_tag_id"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue