bans: change expires_at field to duration.
Changes: * Change the `expires_at` field to `duration`. * Make moderators choose from a fixed set of standard ban lengths, instead of allowing arbitrary ban lengths. * List `duration` in seconds in the /bans.json API. * Dump bans to BigQuery. Note that some old bans have a negative duration. This is because their expiration date was before their creation date, which is because in 2013 bans were migrated to Danbooru 2 and the original ban creation dates were lost.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
class ChangeExpiresAtToDurationOnBans < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
change_column :bans, :expires_at, :interval, using: "expires_at - created_at"
|
||||
rename_column :bans, :expires_at, :duration
|
||||
end
|
||||
|
||||
def down
|
||||
change_column :bans, :duration, :timestamp, using: "created_at + duration"
|
||||
rename_column :bans, :duration, :expires_at
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user