From 96d6478c7ef09821ee36b4625b415fda9c7e7a61 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 09:33:04 +0530 Subject: [PATCH] chore(CE): add catalog and schedule sync resources (#511) Co-authored-by: TivonB-AI2 <124182151+TivonB-AI2@users.noreply.github.com> --- ...add_catalog_and_schedule_sync_resources.rb | 28 +++++++++++++++++++ server/db/data_schema.rb | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 server/db/data/20241204154833_add_catalog_and_schedule_sync_resources.rb diff --git a/server/db/data/20241204154833_add_catalog_and_schedule_sync_resources.rb b/server/db/data/20241204154833_add_catalog_and_schedule_sync_resources.rb new file mode 100644 index 00000000..2ac2e52c --- /dev/null +++ b/server/db/data/20241204154833_add_catalog_and_schedule_sync_resources.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class AddCatalogAndScheduleSyncResources < ActiveRecord::Migration[7.1] + def up + new_resources_data = [ + { + resources_name: "catalog", + permissions: %w[create read update delete] + }, + { + resources_name: "schedule_sync", + permissions: %w[create read update delete] + } + ] + + new_resources_data.each do |resource_data| + resource = Resource.create!( + resources_name: resource_data[:resources_name], + permissions: resource_data[:permissions] + ) + puts "Resource '#{resource.resources_name}' created successfully with permissions: #{resource.permissions}" + end + end + + def down + Resource.where(resources_name: %w[catalog schedule_sync]).destroy_all + end +end diff --git a/server/db/data_schema.rb b/server/db/data_schema.rb index 0189fd23..2c677f92 100644 --- a/server/db/data_schema.rb +++ b/server/db/data_schema.rb @@ -1,3 +1,3 @@ # frozen_string_literal: true -DataMigrate::Data.define(version: 20_241_127_103_943) +DataMigrate::Data.define(version: 20_241_204_154_833)