yajra / laravel-oci8

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

Creating a sequence options #354

Open nikklass opened 7 years ago

nikklass commented 7 years ago

Hi,

Thanks for the package. I wud like to create a sequence with more options than the example given. Is it possible to create a sequence

create sequence MY_TEST_SEQ
minvalue -2147483648
maxvalue -00001
start with -00001
increment by -1
nocache;

I have tried the following, but it seems some options dont exist:

$sequence->create('MY_TEST_SEQ', $start = -00001, $min = -2147483648, $max = -00001, $increment = -1, $nocache = true);

System details

Thanks.

nikklass commented 7 years ago

Why dont you offer some of these functions like create() in sequence as traits so that we can easily override/ customize them if needed?

nikklass commented 7 years ago

You cud add the option i suppose like you currently do in Sequence.php:

public function create($name, $start = 1, $nocache = false, $min = 1, $max = 10000, $increment = 1)
    {
        if (! $name) {
            return false;
        }

        $nocache = $nocache ? 'nocache' : '';

        $sequence_stmt = "create sequence {$name} minvalue {$min} maxvalue {$max} start with {$start} increment by {$increment} {$nocache}";

        return $this->connection->statement($sequence_stmt);

    }

Rgds.

mstaack commented 7 years ago

@nikklass we are open for pull-requests :+1: