-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: add script to hibernate spaces #197
Conversation
…quencer into add-hibernation-toggler
Script has been stripped down to hibernate only spaces inactive more than 1 year ago, and SQL queyr is now simple enough to not warrant a script.ts anymore. Running the following SQL query will hibernate the spaces. WITH toHibernate AS (
WITH data AS (
SELECT
id,
(SELECT MAX(end) FROM proposals WHERE space = spaces.id LIMIT 1) AS lastProposalEndDate
FROM spaces
WHERE hibernated = 0
)
SELECT
id, lastProposalEndDate
FROM data
WHERE
# Filtering out spaces that have not been active in the past year
FROM_UNIXTIME(lastProposalEndDate) < DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR)
)
UPDATE spaces SET hibernated = 1 where id IN (id) Feel free to merge this one, or just run the query separately, and close this PR |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #197 +/- ##
=======================================
Coverage 44.78% 44.78%
=======================================
Files 32 32
Lines 2041 2041
Branches 157 157
=======================================
Hits 914 914
Misses 1122 1122
Partials 5 5 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utAck
Pitch: https://github.com/snapshot-labs/pitches/issues/65
hibernated
columnhibernate
andreactivate
actions to moderation #240)Usage
yarn ts-node scripts/hibernate.ts run
will hibernate inactive spacesyarn ts-node scripts/hibernate.ts preview
will show the number of spaces, eligible for hibernationNote
This is PR is only about supporting the new
hibernated
column, as well as putting spaces to hibernation, and does not handled any kind validation (which requires coordination with UI, and come in a later PR)