Skip to content

Commit

Permalink
Change default value for available column from architectures table to…
Browse files Browse the repository at this point in the history
… false

That way we stop having three values for that column: true, false and
null, and we can get rid of the issue in the
database_consistencty.todo.yml

See
https://github.com/djezzzl/database_consistency/wiki/threestatebooleanchecker
  • Loading branch information
danidoni committed Sep 30, 2024
1 parent 4bf54c0 commit 97eb18c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 0 additions & 3 deletions src/api/.database_consistency.todo.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
Architecture:
available:
ThreeStateBooleanChecker:
enabled: false
id:
PrimaryKeyTypeChecker:
enabled: false
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/architecture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def discard_cache
# Table name: architectures
#
# id :integer not null, primary key
# available :boolean default(FALSE)
# available :boolean default(FALSE), not null
# name :string(255) not null, indexed
#
# Indexes
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddNotNullToArchitecturesAvailable < ActiveRecord::Migration[7.0]
def change
change_column_null :architectures, :available, false
end
end
4 changes: 2 additions & 2 deletions src/api/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_09_16_121900) do
ActiveRecord::Schema[7.0].define(version: 2024_09_27_144404) do
create_table "active_storage_attachments", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
Expand Down Expand Up @@ -51,7 +51,7 @@

create_table "architectures", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", options: "ENGINE=InnoDB ROW_FORMAT=DYNAMIC", force: :cascade do |t|
t.string "name", null: false
t.boolean "available", default: false
t.boolean "available", default: false, null: false
t.index ["name"], name: "arch_name_index", unique: true
end

Expand Down

0 comments on commit 97eb18c

Please sign in to comment.