Added enum to Task model. Added project to project to tasks. Changed Status data type in Tasks.

This commit is contained in:
KaungKaung
2026-01-26 21:50:14 +06:30
parent 6bbbc67a3c
commit f72af5d45f
6 changed files with 25 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
class ChangeStatusTypeInTasks < ActiveRecord::Migration[8.1]
def change
remove_column :tasks, :status, :string
add_column :tasks, :status, :integer, default: 0, null: false
end
end

View File

@@ -0,0 +1,5 @@
class AddProjectToTasks < ActiveRecord::Migration[8.1]
def change
add_reference :tasks, :project, null: false, foreign_key: true
end
end

8
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[8.1].define(version: 2026_01_26_082816) do
ActiveRecord::Schema[8.1].define(version: 2026_01_26_094649) do
create_table "projects", force: :cascade do |t|
t.datetime "created_at", null: false
t.string "description"
@@ -20,8 +20,12 @@ ActiveRecord::Schema[8.1].define(version: 2026_01_26_082816) do
create_table "tasks", force: :cascade do |t|
t.datetime "created_at", null: false
t.string "status"
t.integer "project_id", null: false
t.integer "status", default: 0, null: false
t.string "title"
t.datetime "updated_at", null: false
t.index ["project_id"], name: "index_tasks_on_project_id"
end
add_foreign_key "tasks", "projects"
end