Skip to content

Commit

Permalink
WIP test data scritp
Browse files Browse the repository at this point in the history
  • Loading branch information
ammopt committed Nov 6, 2024
1 parent 870ce68 commit 9d6e3a8
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions code/web/sys/DBMaintenance/community_engagement_updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,41 @@ function getCommunityEngagementUpdates() {
"INSERT INTO role_permissions(roleId, permissionId) VALUES ((SELECT roleId from roles where name='opacAdmin'), (SELECT id from permissions where name='View Community Dashboard'))"
],
],
# !! DEV ONLY !!
'add_test_data' => [
'title' => 'Add Test Data',
'description' => 'Add test data to the community engagement tables',
'sql' => [
"INSERT INTO ce_campaign (name, description, startDate, endDate) VALUES
('Test Campaign 1', 'This is a test campaign', '2022-01-01 00:00:00', '2026-01-31 00:00:00'),
('Test Campaign 2', 'This is a test campaign', '2022-01-01 00:00:00', '2022-01-31 00:00:00'),
('Test Campaign 3', 'This is a test campaign', '2022-01-01 00:00:00', '2022-01-31 00:00:00'),
('Test Campaign 4', 'This is a test campaign', '2026-01-01 00:00:00', '2028-01-31 00:00:00'),
('Test Campaign 5', 'This is a test campaign', '2022-01-01 00:00:00', '2028-01-31 00:00:00')",
"INSERT INTO ce_user_campaign (userId, campaignId, enrollmentDate) VALUES
(3, 5, '2024-11-06 16:55:26'),
(3, 2, '2024-11-06 16:55:26')",
"INSERT INTO ce_milestone (name, conditionalField, conditionalValue, conditionalOperator, milestoneType, campaignId) VALUES
('Test Milestone 1', 'title_display', 'Title', 'equals', 'user_checkout', 1),
('Test Milestone 2', 'author_display', 'Author', 'equals', 'user_hold', 2),
('Test Milestone 3', 'subject_facet', 'Subject', 'equals', 'user_work_review', 3),
('Test Milestone 4', 'user_list', '1', 'equals', 'user_checkout', 3)",
"INSERT INTO ce_campaign_milestones (campaignId, milestoneId, goal, reward) VALUES
(1, 1, 10, -1),
(2, 2, 10, -1),
(3, 3, 10, -1),
(3, 4, 10, -1)",
"INSERT INTO ce_reward (name, description, rewardType) VALUES
('Test Reward 1', 'This is a test reward', 0),
('Test Reward 2', 'This is a test reward', 0),
('Test Reward 3', 'This is a test reward', 0)",
"INSERT INTO ce_milestone_users_progress (userId, ce_milestone_id, progress, rewardGiven) VALUES
(3, 1, 4, 1),
(3, 2, 6, 0),
(3, 3, 3, 1),
(3, 4, 8, 0)",
"UPDATE modules SET enabled = 1 WHERE name = 'Community'"
],
],
];
}

0 comments on commit 9d6e3a8

Please sign in to comment.