From 897743ec1e6fb4ad3832b00d5507cac11d9f64ff Mon Sep 17 00:00:00 2001 From: Kaio Magalhaes Date: Thu, 21 Mar 2024 08:11:42 -0300 Subject: [PATCH] update start date and end date on the assignments/requirements --- app/models/assignment.rb | 4 ++-- app/models/requirement.rb | 4 ++-- ...0012_change_date_to_date_time_in_requirements.rb | 13 +++++++++++++ ...10927_change_date_to_date_time_in_assignments.rb | 13 +++++++++++++ db/schema.rb | 10 +++++----- spec/factories/assignments.rb | 4 ++-- spec/factories/requirements.rb | 4 ++-- spec/models/assignment_spec.rb | 4 ++-- spec/models/requirement_spec.rb | 4 ++-- 9 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 db/migrate/20240321110012_change_date_to_date_time_in_requirements.rb create mode 100644 db/migrate/20240321110927_change_date_to_date_time_in_assignments.rb diff --git a/app/models/assignment.rb b/app/models/assignment.rb index ce0330d..22fea0c 100644 --- a/app/models/assignment.rb +++ b/app/models/assignment.rb @@ -6,8 +6,8 @@ # # id :bigint not null, primary key # coverage :float -# end_date :date -# start_date :date +# end_date :datetime +# start_date :datetime # created_at :datetime not null # updated_at :datetime not null # requirement_id :bigint not null diff --git a/app/models/requirement.rb b/app/models/requirement.rb index ae0dfe3..09de215 100644 --- a/app/models/requirement.rb +++ b/app/models/requirement.rb @@ -6,8 +6,8 @@ # # id :bigint not null, primary key # coverage :float -# end_date :date -# start_date :date +# end_date :datetime +# start_date :datetime # created_at :datetime not null # updated_at :datetime not null # profession_id :bigint not null diff --git a/db/migrate/20240321110012_change_date_to_date_time_in_requirements.rb b/db/migrate/20240321110012_change_date_to_date_time_in_requirements.rb new file mode 100644 index 0000000..00096fe --- /dev/null +++ b/db/migrate/20240321110012_change_date_to_date_time_in_requirements.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class ChangeDateToDateTimeInRequirements < ActiveRecord::Migration[7.0] + def up + change_column :requirements, :end_date, :datetime + change_column :requirements, :start_date, :datetime + end + + def down + change_column :requirements, :end_date, :date + change_column :requirements, :start_date, :date + end +end diff --git a/db/migrate/20240321110927_change_date_to_date_time_in_assignments.rb b/db/migrate/20240321110927_change_date_to_date_time_in_assignments.rb new file mode 100644 index 0000000..5a110ea --- /dev/null +++ b/db/migrate/20240321110927_change_date_to_date_time_in_assignments.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class ChangeDateToDateTimeInAssignments < ActiveRecord::Migration[7.0] + def up + change_column :assignments, :end_date, :datetime + change_column :assignments, :start_date, :datetime + end + + def down + change_column :assignments, :end_date, :date + change_column :assignments, :start_date, :date + end +end diff --git a/db/schema.rb b/db/schema.rb index 9f7b97f..6bc2128 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[7.0].define(version: 2024_03_12_200929) do +ActiveRecord::Schema[7.0].define(version: 2024_03_21_110927) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" enable_extension "plpgsql" @@ -20,8 +20,8 @@ t.bigint "requirement_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.date "start_date" - t.date "end_date" + t.datetime "start_date" + t.datetime "end_date" t.bigint "user_id", null: false t.index ["requirement_id"], name: "index_assignments_on_requirement_id" t.index ["user_id"], name: "index_assignments_on_user_id" @@ -137,8 +137,8 @@ t.float "coverage" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.date "start_date" - t.date "end_date" + t.datetime "start_date" + t.datetime "end_date" t.index ["profession_id"], name: "index_requirements_on_profession_id" t.index ["statement_of_work_id"], name: "index_requirements_on_statement_of_work_id" end diff --git a/spec/factories/assignments.rb b/spec/factories/assignments.rb index 4ac6b6f..cab6c48 100644 --- a/spec/factories/assignments.rb +++ b/spec/factories/assignments.rb @@ -6,8 +6,8 @@ # # id :bigint not null, primary key # coverage :float -# end_date :date -# start_date :date +# end_date :datetime +# start_date :datetime # created_at :datetime not null # updated_at :datetime not null # requirement_id :bigint not null diff --git a/spec/factories/requirements.rb b/spec/factories/requirements.rb index 1e6802c..73ac4cd 100644 --- a/spec/factories/requirements.rb +++ b/spec/factories/requirements.rb @@ -6,8 +6,8 @@ # # id :bigint not null, primary key # coverage :float -# end_date :date -# start_date :date +# end_date :datetime +# start_date :datetime # created_at :datetime not null # updated_at :datetime not null # profession_id :bigint not null diff --git a/spec/models/assignment_spec.rb b/spec/models/assignment_spec.rb index 108d658..0ce7d7d 100644 --- a/spec/models/assignment_spec.rb +++ b/spec/models/assignment_spec.rb @@ -6,8 +6,8 @@ # # id :bigint not null, primary key # coverage :float -# end_date :date -# start_date :date +# end_date :datetime +# start_date :datetime # created_at :datetime not null # updated_at :datetime not null # requirement_id :bigint not null diff --git a/spec/models/requirement_spec.rb b/spec/models/requirement_spec.rb index f3fecee..8a7e174 100644 --- a/spec/models/requirement_spec.rb +++ b/spec/models/requirement_spec.rb @@ -6,8 +6,8 @@ # # id :bigint not null, primary key # coverage :float -# end_date :date -# start_date :date +# end_date :datetime +# start_date :datetime # created_at :datetime not null # updated_at :datetime not null # profession_id :bigint not null