yajra / laravel-oci8

Oracle DB driver for Laravel via OCI8
https://yajrabox.com/docs/laravel-oci8
MIT License
834 stars 237 forks source link

`Schema::dropIfExists()` not working in 11.2.2+ #853

Closed staudenmeir closed 5 months ago

staudenmeir commented 5 months ago

Summary of problem or feature request

Hi @yajra, Schema::dropIfExists() no longer works for me since version 11.2.2. The table doesn't get dropped when it exists.

I traced it to this change: https://github.com/yajra/laravel-oci8/commit/dfebaf8bd59781983372de1cbc071af370105e52

Code snippet of problem

Schema::dropIfExists('users');

Executed SQL in 11.2.1:

declare
    c int;
begin
    select count(*) into c from user_tables where table_name = upper('users');
    if c = 1 then
        execute immediate 'drop table users';
    end if;
end;

Executed SQL in 11.2.2:

declare
    c int;
begin
    select count(*) into c from user_tables where table_name = upper('"USERS"');
    if c = 1 then
        execute immediate 'drop table "USERS"';
    end if;
end;

The issue is this part where the table name gets wrapped in two pairs of quotes:

upper('"USERS"')

System details

yajra commented 5 months ago

Fixed in v11.2.4. thanks for reporting. 🍻

staudenmeir commented 5 months ago

Thanks!