Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove max length from group_name #6668

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Group < ApplicationRecord

validates :group_name, presence: true, exclusion: { in: Repository.get_class.reserved_locations }
validates :group_name, uniqueness: { scope: :course_id }
validates :group_name, length: { maximum: 30 }
validates :group_name, length: { maximum: 100 }
validates :group_name, format: { with: /\A[a-zA-Z0-9\-_ ]+\z/,
message: 'must only contain alphanumeric, hyphen, a blank space, or ' \
'underscore' }
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20230713153536_increase_group_name_length.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class IncreaseGroupNameLength < ActiveRecord::Migration[7.0]
def change
change_column :groups, :group_name, :string, {:limit => 100}
end
end
5 changes: 3 additions & 2 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ CREATE TABLE public.groupings_tags (

CREATE TABLE public.groups (
id integer NOT NULL,
group_name character varying(30),
group_name character varying(100),
repo_name character varying,
course_id bigint NOT NULL
);
Expand Down Expand Up @@ -4690,4 +4690,5 @@ INSERT INTO "schema_migrations" (version) VALUES
('20221111182002'),
('20221219204837'),
('20230109190029'),
('20230303030615');
('20230303030615'),
('20230713153536');
2 changes: 1 addition & 1 deletion spec/models/group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

it { is_expected.to validate_presence_of(:group_name) }
it { is_expected.to validate_uniqueness_of(:group_name).scoped_to(:course_id) }
it { is_expected.to validate_length_of(:group_name).is_at_most(30) }
it { is_expected.to validate_length_of(:group_name).is_at_most(100) }

it { is_expected.not_to allow_value('Mike !Ooh').for(:group_name) }
it { is_expected.not_to allow_value('A!a.sa').for(:group_name) }
Expand Down