Task status model + default task status generation

This commit is contained in:
2025-10-22 02:01:10 +03:00
parent 293bc06d1e
commit ae1df5f608
7 changed files with 82 additions and 21 deletions
@@ -0,0 +1,13 @@
class CreateTaskStatuses < ActiveRecord::Migration[8.0]
def change
create_table :task_statuses do |t|
t.references :project, null: false, foreign_key: true
t.string :name, null: false
t.integer :category, limit: 2, unsigned: true, null: false
t.index %i[project_id name], unique: true
t.index %i[project_id category name]
t.timestamps
end
end
end
Generated
+13 -1
View File
@@ -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_180400) do
ActiveRecord::Schema[8.0].define(version: 2025_10_21_204013) 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
@@ -69,6 +69,17 @@ ActiveRecord::Schema[8.0].define(version: 2025_10_21_180400) do
t.index ["user_id"], name: "index_sessions_on_user_id"
end
create_table "task_statuses", charset: "utf8mb4", collation: "utf8mb4_uca1400_ai_ci", force: :cascade do |t|
t.bigint "project_id", null: false
t.string "name", null: false
t.integer "category", limit: 2, null: false, unsigned: true
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["project_id", "category", "name"], name: "index_task_statuses_on_project_id_and_category_and_name"
t.index ["project_id", "name"], name: "index_task_statuses_on_project_id_and_name", unique: true
t.index ["project_id"], name: "index_task_statuses_on_project_id"
end
create_table "tasks", charset: "utf8mb4", collation: "utf8mb4_uca1400_ai_ci", force: :cascade do |t|
t.bigint "project_id", null: false
t.integer "number", null: false
@@ -89,5 +100,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_10_21_180400) do
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "sessions", "users"
add_foreign_key "task_statuses", "projects"
add_foreign_key "tasks", "projects"
end