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

[Admin] Add new migrations and validations in core to support new admin Spree::Role interface #5833

Merged
Merged
Show file tree
Hide file tree
Changes from all 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 core/app/models/spree/role.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Role < Spree::Base
has_many :role_users, class_name: "Spree::RoleUser", dependent: :destroy
has_many :users, through: :role_users

validates_uniqueness_of :name, case_sensitive: true
validates :name, presence: true, uniqueness: { case_sensitive: true, allow_blank: true }

def admin?
name == "admin"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateSpreePermissionSetsInCore < ActiveRecord::Migration[7.0]
def change
create_table :spree_permission_sets, if_not_exists: true do |t|
t.string :name
t.string :set
t.timestamps null: false
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateSpreeRolesPermissionsInCore < ActiveRecord::Migration[7.0]
def change
create_table :spree_role_permissions, if_not_exists: true do |t|
t.references :role
t.references :permission_set
t.timestamps null: false
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddDescriptionToSpreeRoles < ActiveRecord::Migration[7.0]
def change
add_column :spree_roles, :description, :text
end
end