diff --git a/Gemfile b/Gemfile index c4aca79..9a38f1f 100644 --- a/Gemfile +++ b/Gemfile @@ -64,3 +64,5 @@ group :test do gem "capybara" gem "selenium-webdriver" end + +gem "tailwindcss", "~> 0.1.1" diff --git a/Gemfile.lock b/Gemfile.lock index 6700a33..a486f73 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 diff --git a/app/models/task.rb b/app/models/task.rb index 1d95805..d994ea3 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -1,3 +1,5 @@ class Task < ApplicationRecord - balongs_to :project + belongs_to :project + + enum :status, { to_do: 0, in_progress: 1, done: 2 } end diff --git a/db/migrate/20260126091632_change_status_type_in_tasks.rb b/db/migrate/20260126091632_change_status_type_in_tasks.rb new file mode 100644 index 0000000..5ac5381 --- /dev/null +++ b/db/migrate/20260126091632_change_status_type_in_tasks.rb @@ -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 diff --git a/db/migrate/20260126094649_add_project_to_tasks.rb b/db/migrate/20260126094649_add_project_to_tasks.rb new file mode 100644 index 0000000..031681a --- /dev/null +++ b/db/migrate/20260126094649_add_project_to_tasks.rb @@ -0,0 +1,5 @@ +class AddProjectToTasks < ActiveRecord::Migration[8.1] + def change + add_reference :tasks, :project, null: false, foreign_key: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 7379b52..2ea0ef3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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