-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make several additional columns NOT NULL
The following columns are always set by Delayed Jobs and therefore expected to have a value and so can safely be set to be NOT NULL. - run_at - queue - timestamps (created_at, updated_at) By enforcing these are NOT NULL at the database layer, it improves data integrity by hardening the schema constraints.
- Loading branch information
Showing
3 changed files
with
16 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class ColumnsNotNull < ActiveRecord::Migration<%= migration_version %> | ||
def change | ||
change_column_null :delayed_jobs, :run_at, false | ||
change_column_null :delayed_jobs, :queue, false | ||
change_column_null :delayed_jobs, :created_at, false | ||
change_column_null :delayed_jobs, :updated_at, false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters