diff --git a/core/app/models/spree/role.rb b/core/app/models/spree/role.rb index 3e2d7d1a234..6d140ed6ef0 100644 --- a/core/app/models/spree/role.rb +++ b/core/app/models/spree/role.rb @@ -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" diff --git a/core/db/migrate/20240821173254_create_spree_permission_sets_in_core.rb b/core/db/migrate/20240821173254_create_spree_permission_sets_in_core.rb new file mode 100644 index 00000000000..bf827a11fa8 --- /dev/null +++ b/core/db/migrate/20240821173254_create_spree_permission_sets_in_core.rb @@ -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 diff --git a/core/db/migrate/20240821173341_create_spree_roles_permissions_in_core.rb b/core/db/migrate/20240821173341_create_spree_roles_permissions_in_core.rb new file mode 100644 index 00000000000..d4bac14e445 --- /dev/null +++ b/core/db/migrate/20240821173341_create_spree_roles_permissions_in_core.rb @@ -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 diff --git a/core/db/migrate/20240821173641_add_description_to_spree_roles.rb b/core/db/migrate/20240821173641_add_description_to_spree_roles.rb new file mode 100644 index 00000000000..3578008ebf1 --- /dev/null +++ b/core/db/migrate/20240821173641_add_description_to_spree_roles.rb @@ -0,0 +1,5 @@ +class AddDescriptionToSpreeRoles < ActiveRecord::Migration[7.0] + def change + add_column :spree_roles, :description, :text + end +end