Made projects' status not null
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class MakeProjectsStatusNotNull < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
change_column_null :projects, :status, false
|
||||
end
|
||||
end
|
||||
Generated
+2
-2
@@ -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"
|
||||
|
||||
@@ -7,6 +7,7 @@ services:
|
||||
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 1
|
||||
volumes:
|
||||
- mariadb:/var/lib/mysql
|
||||
profiles: [resources, dev]
|
||||
|
||||
volumes:
|
||||
mariadb:
|
||||
|
||||
Reference in New Issue
Block a user