added unique index to build id

This commit is contained in:
Chris
2025-09-03 19:30:37 -07:00
parent 099511a861
commit a8f1d20501
7 changed files with 13 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
# Table name: build_configurations
#
# id :bigint not null, primary key
# build_type :integer default(0), not null
# driver :integer not null
# image_repository :string not null
# created_at :datetime not null

View File

@@ -10,7 +10,7 @@
#
# Indexes
#
# index_deployments_on_build_id (build_id)
# index_deployments_on_build_id (build_id) UNIQUE
#
# Foreign Keys
#

View File

@@ -0,0 +1,6 @@
class AddUniqueIndexToBuildId < ActiveRecord::Migration[7.2]
def change
remove_index :deployments, :build_id
add_index :deployments, :build_id, unique: true
end
end

4
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.2].define(version: 2025_09_02_182502) do
ActiveRecord::Schema[7.2].define(version: 2025_09_04_022903) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -150,7 +150,7 @@ ActiveRecord::Schema[7.2].define(version: 2025_09_02_182502) do
t.integer "status", default: 0, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["build_id"], name: "index_deployments_on_build_id"
t.index ["build_id"], name: "index_deployments_on_build_id", unique: true
end
create_table "domains", force: :cascade do |t|

View File

@@ -3,6 +3,7 @@
# Table name: build_configurations
#
# id :bigint not null, primary key
# build_type :integer default(0), not null
# driver :integer not null
# image_repository :string not null
# created_at :datetime not null

View File

@@ -10,7 +10,7 @@
#
# Indexes
#
# index_deployments_on_build_id (build_id)
# index_deployments_on_build_id (build_id) UNIQUE
#
# Foreign Keys
#

View File

@@ -3,6 +3,7 @@
# Table name: build_configurations
#
# id :bigint not null, primary key
# build_type :integer default(0), not null
# driver :integer not null
# image_repository :string not null
# created_at :datetime not null