Fix error when deleting supabase_users_field_table to recreate the table instead

Created on 20 July 2024, 5 months ago
Updated 2 August 2024, 5 months ago

Problem

When attempting to delete the existing supabase_users_field_table from the database, an error is thrown on the screen. This behavior is not user-friendly and should be handled more gracefully.

Current Behavior

Deleting the supabase_users_field_table from the database results in an error being displayed on the screen.

Expected Behavior

Instead of throwing an error, the module should recreate the supabase_users_field_table if it is deleted.

Steps to Reproduce

  1. Delete the supabase_users_field_table from the database.
  2. Observe the error thrown on the screen.

Suggested Solution

Modify the code to check for the existence of the table and recreate it if it has been deleted. This can be handled in the moduleโ€™s install or update hooks.

Relevant Code

The relevant code where the error occurs is in the SupabaseService class and the supabase_authentication.install file.

SupabaseService.php

public function dropTable() {
  $schema = $this->database->schema();
  if ($schema->tableExists('supabase_users_field_table')) {
    $schema->dropTable('supabase_users_field_table');
  }
}

supabase_authentication.install

function supabase_authentication_install() {
  // Code to recreate the table if it is deleted.
}

Additional Information

This improvement will enhance the user experience by handling the table recreation seamlessly.

๐Ÿ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia md61421 Delhi

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024