add sticker column to submissions table

closes EVAL-2976
flag=submission_stickers

Test Plan:
- run migrations
- open a rails console, and fetch a submission:

  s = Submission.first

- verify the submission has a default sticker of `nil`:

  s.sticker
  => nil

- verify the sticker can be updated:

  s.update!(sticker: "foo")

- verify the sticker name cannot exceed 255 characters

  s.update!(sticker: "a" * 255) # should succeed
  s.update!(sticker: "a" * 256) # should fail

Change-Id: I0839c5848438db5ad8fbf5bdb568187578c68afb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/313762
Reviewed-by: Christopher Soto <christopher.soto@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Spencer Olson <solson@instructure.com>
Product-Review: Cameron Ray <cameron.ray@instructure.com>
This commit is contained in:
Spencer Olson 2023-03-20 15:07:16 -05:00
parent da66201c28
commit 013b2dc857
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
# frozen_string_literal: true
#
# Copyright (C) 2023 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
class AddStickerToSubmissions < ActiveRecord::Migration[7.0]
tag :predeploy
def change
add_column :submissions, :sticker, :string, limit: 255
end
end