diff --git a/CHANGELOG.md b/CHANGELOG.md index 37eede76..d1ce1fef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ ### Fixed - Add explanation of sign-up step at sign-up page when email sign-up mode +- Add NOT NULL constraint to email_blocklist table fields ## [[0.7.1]] - 2022-01-12 diff --git a/migrations/postgres/2022-01-29-154457_add_not_null_constraint_to_email_blocklist/down.sql b/migrations/postgres/2022-01-29-154457_add_not_null_constraint_to_email_blocklist/down.sql new file mode 100644 index 00000000..e406ff43 --- /dev/null +++ b/migrations/postgres/2022-01-29-154457_add_not_null_constraint_to_email_blocklist/down.sql @@ -0,0 +1,4 @@ +ALTER TABLE email_blocklist ALTER COLUMN notification_text DROP NOT NULL; +ALTER TABLE email_blocklist ALTER COLUMN notify_user DROP NOT NULL; +ALTER TABLE email_blocklist ALTER COLUMN note DROP NOT NULL; +ALTER TABLE email_blocklist ALTER COLUMN email_address DROP NOT NULL; diff --git a/migrations/postgres/2022-01-29-154457_add_not_null_constraint_to_email_blocklist/up.sql b/migrations/postgres/2022-01-29-154457_add_not_null_constraint_to_email_blocklist/up.sql new file mode 100644 index 00000000..ad76cfd4 --- /dev/null +++ b/migrations/postgres/2022-01-29-154457_add_not_null_constraint_to_email_blocklist/up.sql @@ -0,0 +1,4 @@ +ALTER TABLE email_blocklist ALTER COLUMN email_address SET NOT NULL; +ALTER TABLE email_blocklist ALTER COLUMN note SET NOT NULL; +ALTER TABLE email_blocklist ALTER COLUMN notify_user SET NOT NULL; +ALTER TABLE email_blocklist ALTER COLUMN notification_text SET NOT NULL; diff --git a/migrations/sqlite/2022-01-29-154457_add_not_null_constraint_to_email_blocklist/down.sql b/migrations/sqlite/2022-01-29-154457_add_not_null_constraint_to_email_blocklist/down.sql new file mode 100644 index 00000000..df77c239 --- /dev/null +++ b/migrations/sqlite/2022-01-29-154457_add_not_null_constraint_to_email_blocklist/down.sql @@ -0,0 +1,9 @@ +CREATE TABLE email_blocklist2(id INTEGER PRIMARY KEY, + email_address TEXT UNIQUE, + note TEXT, + notify_user BOOLEAN DEFAULT FALSE, + notification_text TEXT); + +INSERT INTO email_blocklist2 SELECT * FROM email_blocklist; +DROP TABLE email_blocklist; +ALTER TABLE email_blocklist2 RENAME TO email_blocklist; diff --git a/migrations/sqlite/2022-01-29-154457_add_not_null_constraint_to_email_blocklist/up.sql b/migrations/sqlite/2022-01-29-154457_add_not_null_constraint_to_email_blocklist/up.sql new file mode 100644 index 00000000..ce725816 --- /dev/null +++ b/migrations/sqlite/2022-01-29-154457_add_not_null_constraint_to_email_blocklist/up.sql @@ -0,0 +1,9 @@ +CREATE TABLE email_blocklist2(id INTEGER PRIMARY KEY, + email_address TEXT UNIQUE NOT NULL, + note TEXT NOT NULL, + notify_user BOOLEAN DEFAULT FALSE NOT NULL, + notification_text TEXT NOT NULL); + +INSERT INTO email_blocklist2 SELECT * FROM email_blocklist; +DROP TABLE email_blocklist; +ALTER TABLE email_blocklist2 RENAME TO email_blocklist; diff --git a/plume-models/src/schema.rs b/plume-models/src/schema.rs index db492a08..70be8419 100644 --- a/plume-models/src/schema.rs +++ b/plume-models/src/schema.rs @@ -75,9 +75,9 @@ table! { } table! { - email_blocklist(id){ + email_blocklist (id) { id -> Int4, - email_address -> VarChar, + email_address -> Text, note -> Text, notify_user -> Bool, notification_text -> Text, @@ -316,6 +316,7 @@ allow_tables_to_appear_in_same_query!( blogs, comments, comment_seers, + email_blocklist, email_signups, follows, instances,