Skip to content

Commit

Permalink
Drop indexes only if they exist (https://forum.pkp.sfu.ca/t/ojs-upgra…
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher authored and ipula committed Jan 11, 2024
1 parent fba374f commit f0ed82f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public function up(): void
{
switch (DB::getDriverName()) {
case 'pgsql':
DB::unprepared('DROP INDEX users_username;');
DB::unprepared('DROP INDEX users_email;');
DB::unprepared('DROP INDEX IF EXISTS users_username;');
DB::unprepared('DROP INDEX IF EXISTS users_email;');

DB::unprepared('CREATE UNIQUE INDEX users_username on users (LOWER(username));');
DB::unprepared('CREATE UNIQUE INDEX users_email on users (LOWER(email));');
Expand All @@ -36,8 +36,8 @@ public function down(): void
{
switch (DB::getDriverName()) {
case 'pgsql':
DB::unprepared('DROP INDEX users_username;');
DB::unprepared('DROP INDEX users_email;');
DB::unprepared('DROP INDEX IF EXISTS users_username;');
DB::unprepared('DROP INDEX IF EXISTS users_email;');

DB::unprepared('CREATE UNIQUE INDEX users_username on users (username);');
DB::unprepared('CREATE UNIQUE INDEX users_email on users (email);');
Expand Down

0 comments on commit f0ed82f

Please sign in to comment.