Added enum to Task model. Added project to project to tasks. Changed Status data type in Tasks.
This commit is contained in:
6
db/migrate/20260126091632_change_status_type_in_tasks.rb
Normal file
6
db/migrate/20260126091632_change_status_type_in_tasks.rb
Normal 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
|
||||
5
db/migrate/20260126094649_add_project_to_tasks.rb
Normal file
5
db/migrate/20260126094649_add_project_to_tasks.rb
Normal 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
8
db/schema.rb
generated
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user