Skip to content

Commit feece7e

Browse files
committed
Restore defaults in a separate migration
1 parent 2b19ff2 commit feece7e

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

db/migrate/20240502142444_add_not_null_constraints_to_booleans.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
class AddNotNullConstraintsToBooleans < ActiveRecord::Migration[7.0]
22
def change
3-
change_column_default :collections, :email_when_participants_changed, true
4-
change_column_default :collections, :email_depositors_status_changed, true
5-
63
change_column_null :collections, :email_when_participants_changed, false
74
change_column_null :collections, :email_depositors_status_changed, false
85
change_column_null :collections, :review_enabled, false
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class RestoreDefaultsToBooleans < ActiveRecord::Migration[7.0]
2+
def change
3+
change_column_default :collections, :email_when_participants_changed, true
4+
change_column_default :collections, :email_depositors_status_changed, true
5+
end
6+
end

db/structure.sql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,12 @@ CREATE TABLE public.collections (
295295
access character varying,
296296
required_license character varying,
297297
default_license character varying,
298-
email_when_participants_changed boolean NOT NULL,
298+
email_when_participants_changed boolean DEFAULT true NOT NULL,
299299
created_at timestamp(6) without time zone NOT NULL,
300300
updated_at timestamp(6) without time zone NOT NULL,
301301
creator_id bigint NOT NULL,
302302
druid character varying,
303-
email_depositors_status_changed boolean NOT NULL,
303+
email_depositors_status_changed boolean DEFAULT true NOT NULL,
304304
review_enabled boolean DEFAULT false NOT NULL,
305305
license_option character varying DEFAULT 'required'::character varying NOT NULL,
306306
head_id bigint,
@@ -1497,6 +1497,7 @@ INSERT INTO "schema_migrations" (version) VALUES
14971497
('20230705222153'),
14981498
('20230726172521'),
14991499
('20240501135224'),
1500-
('20240502142444');
1500+
('20240502142444'),
1501+
('20240503114446');
15011502

15021503

0 commit comments

Comments
 (0)