Added enum to Task model. Added project to project to tasks. Changed Status data type in Tasks.
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -64,3 +64,5 @@ group :test do
|
||||
gem "capybara"
|
||||
gem "selenium-webdriver"
|
||||
end
|
||||
|
||||
gem "tailwindcss", "~> 0.1.1"
|
||||
|
||||
@@ -351,6 +351,7 @@ GEM
|
||||
stimulus-rails (1.3.4)
|
||||
railties (>= 6.0.0)
|
||||
stringio (3.2.0)
|
||||
tailwindcss (0.1.1)
|
||||
thor (1.5.0)
|
||||
thruster (0.1.17)
|
||||
thruster (0.1.17-aarch64-linux)
|
||||
@@ -415,6 +416,7 @@ DEPENDENCIES
|
||||
solid_queue
|
||||
sqlite3 (>= 2.1)
|
||||
stimulus-rails
|
||||
tailwindcss (~> 0.1.1)
|
||||
thruster
|
||||
turbo-rails
|
||||
tzinfo-data
|
||||
@@ -552,6 +554,7 @@ CHECKSUMS
|
||||
sshkit (1.25.0) sha256=c8c6543cdb60f91f1d277306d585dd11b6a064cb44eab0972827e4311ff96744
|
||||
stimulus-rails (1.3.4) sha256=765676ffa1f33af64ce026d26b48e8ffb2e0b94e0f50e9119e11d6107d67cb06
|
||||
stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
|
||||
tailwindcss (0.1.1) sha256=cdd453b13267d6441cba86cc6bf2b91e06bf01171983d90701b8d9b634d3be75
|
||||
thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
|
||||
thruster (0.1.17) sha256=6f3f1de43e22f0162d81cbc363f45ee42a1b8460213856c1a899cbf0d3297235
|
||||
thruster (0.1.17-aarch64-linux) sha256=1b3a34b2814185c2aeaf835b5ecff5348cdcf8e77809f7a092d46e4b962a16ba
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
class Task < ApplicationRecord
|
||||
balongs_to :project
|
||||
belongs_to :project
|
||||
|
||||
enum :status, { to_do: 0, in_progress: 1, done: 2 }
|
||||
end
|
||||
|
||||
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