From 970146f71000960777f8727e564bdeb93d65e010 Mon Sep 17 00:00:00 2001 From: Utsav Sethi Date: Mon, 13 Jan 2020 15:19:23 -0600 Subject: [PATCH] Change "todos.description" from "string" to "text" DB field "todos.description" was type string, which defaults to length 255 in MySQL. Model allows field to be up to 300 characters, which could cause a DB error, if user saved a description of between 255 and 300 characters. --- db/migrate/20200109231555_change_todo_description.rb | 12 ++++++++++++ db/schema.rb | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20200109231555_change_todo_description.rb diff --git a/db/migrate/20200109231555_change_todo_description.rb b/db/migrate/20200109231555_change_todo_description.rb new file mode 100644 index 00000000..d6fe3b5c --- /dev/null +++ b/db/migrate/20200109231555_change_todo_description.rb @@ -0,0 +1,12 @@ +class ChangeTodoDescription < ActiveRecord::Migration[5.2] + def up + change_table :todos do |t| + t.change :description, :text + end + end + def down + change_table :todos do |t| + t.change :description, :string + end + end +end diff --git a/db/schema.rb b/db/schema.rb index d961d407..539e80c0 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.define(version: 2019_06_18_202817) do +ActiveRecord::Schema.define(version: 2020_01_09_231555) do create_table "attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.integer "todo_id" @@ -166,7 +166,7 @@ ActiveRecord::Schema.define(version: 2019_06_18_202817) do create_table "todos", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.integer "context_id", null: false t.integer "project_id" - t.string "description", null: false + t.text "description", null: false t.text "notes", limit: 16777215 t.datetime "created_at" t.datetime "due"