From f755addae6b473dbfe76c701cedc3a0eb39ff311 Mon Sep 17 00:00:00 2001 From: swag Date: Sat, 19 Nov 2022 21:50:23 -0500 Subject: [PATCH] Make email_addr unique --- lib/PostText.pm | 2 +- migrations/10/down.sql | 3 +++ migrations/10/up.sql | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 migrations/10/down.sql create mode 100644 migrations/10/up.sql diff --git a/lib/PostText.pm b/lib/PostText.pm index 43c874f..51f7f5f 100644 --- a/lib/PostText.pm +++ b/lib/PostText.pm @@ -53,7 +53,7 @@ sub startup($self) { # Finish configuring some things $self->secrets($self->config->{'secrets'}) || die $@; - $self->pg->migrations->from_dir('migrations')->migrate(9); + $self->pg->migrations->from_dir('migrations')->migrate(10); if (my $threads_per_page = $self->config->{'threads_per_page'}) { $self->thread->per_page($threads_per_page) diff --git a/migrations/10/down.sql b/migrations/10/down.sql new file mode 100644 index 0000000..da31641 --- /dev/null +++ b/migrations/10/down.sql @@ -0,0 +1,3 @@ +ALTER TABLE moderators + DROP CONSTRAINT moderators_email_addr_key; + diff --git a/migrations/10/up.sql b/migrations/10/up.sql new file mode 100644 index 0000000..48d25b4 --- /dev/null +++ b/migrations/10/up.sql @@ -0,0 +1,2 @@ +ALTER TABLE moderators + ADD UNIQUE (email_addr);