diff --git a/app/models/project.rb b/app/models/project.rb index 19bdf44..4276e4b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -3,7 +3,7 @@ class Project < ApplicationRecord enum :status, %w[preparing ready archived].index_by(&:itself), default: :preparing - validates :name, :code, presence: true + validates :name, :code, :status, presence: true validates :code, exclusion: { in: %w[new] }, uniqueness: true, format: { with: /\A[a-z]{2,}\z/ } has_many :tasks, dependent: :restrict_with_exception diff --git a/db/migrate/20251025131322_make_projects_status_not_null.rb b/db/migrate/20251025131322_make_projects_status_not_null.rb new file mode 100644 index 0000000..28e2269 --- /dev/null +++ b/db/migrate/20251025131322_make_projects_status_not_null.rb @@ -0,0 +1,5 @@ +class MakeProjectsStatusNotNull < ActiveRecord::Migration[8.0] + def change + change_column_null :projects, :status, false + end +end diff --git a/db/schema.rb b/db/schema.rb index bc1539c..7bbe5e3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2025_10_21_204013) do +ActiveRecord::Schema[8.0].define(version: 2025_10_25_131322) do create_table "action_text_rich_texts", charset: "utf8mb4", collation: "utf8mb4_uca1400_ai_ci", force: :cascade do |t| t.string "name", null: false t.text "body", size: :long @@ -54,7 +54,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_10_21_204013) do t.string "code", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.string "status" + t.string "status", null: false t.index ["code"], name: "index_projects_on_code", unique: true t.index ["name"], name: "index_projects_on_name" t.index ["status"], name: "index_projects_on_status" diff --git a/docker-compose.yml b/docker-compose.yml index 18c3258..7f14ba0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,7 @@ services: MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 1 volumes: - mariadb:/var/lib/mysql + profiles: [resources, dev] volumes: mariadb: