Skip to content

Releases: umbrellio/laravel-pg-extensions

Added PostgresTypeColumnAssertion

23 Aug 17:21
40a48a2
Compare
Choose a tag to compare

Moving helpers for assertions

23 Aug 15:49
Compare
Choose a tag to compare

Added support creating Exclude/Check constraints

06 Aug 21:11
Compare
Choose a tag to compare
Added support creating EXCLUDE/CHECK constraints (#23)

EXCLUDE constraints
https://www.postgresql.org/docs/9.0/sql-createtable.html#SQL-CREATETABLE-EXCLUDE

Using the example below:

Schema::create('table', function (Blueprint $table) {
    $table->integer('type_id'); 
    $table->date('date_start'); 
    $table->date('date_end'); 
    $table->softDeletes();
    $table
        ->exclude(['date_start', 'date_end'])
        ->using('type_id', '=')
        ->using('daterange(date_start, date_end)', '&&')
        ->method('gist')
        ->with('some_arg', 1)
        ->with('any_arg', 'some_value')
        ->whereNull('deleted_at');
});
An Exclude Constraint will be generated for your table:

ALTER TABLE test_table
    ADD CONSTRAINT test_table_date_start_date_end_excl
        EXCLUDE USING gist (type_id WITH =, daterange(date_start, date_end) WITH &&)
        WITH (some_arg = 1, any_arg = 'some_value')
        WHERE ("deleted_at" is null)
CHECK constraints
https://www.postgresql.org/docs/9.4/ddl-constraints.html#DDL-CONSTRAINTS-CHECK-CONSTRAINTS

Using the example below:

Schema::create('table', function (Blueprint $table) {
    $table->integer('type_id'); 
    $table->date('date_start'); 
    $table->date('date_end'); 
    $table
        ->check(['date_start', 'date_end'])
        ->whereColumn('date_end', '>', 'date_end')
        ->whereIn('type_id', [1, 2, 3]);
});
An Check Constraint will be generated for your table:

ALTER TABLE test_table
    ADD CONSTRAINT test_table_date_start_date_end_chk
        CHECK ("date_end" > "date_start" AND "type_id" IN [1, 2, 3])

Added support deleting UNIQUE partial indexes

06 Aug 19:57
Compare
Choose a tag to compare
Added support deleting UNIQUE partial indexes (#22)

Added support for deleting unique indexes with WHERE conditions.

By default, if the created unique index contains no conditions, PostgresSQL automatically creates a Constraint for it, for example:

CREATE UNIQUE INDEX CONCURRENTLY examples_new_col_idx ON examples (new_col);
ALTER TABLE examples
    ADD CONSTRAINT examples_unique_constraint USING INDEX examples_new_col_idx;
If the unique index contains WHERE conditions, then such a Constraint will not be created, because PostgreSQL doesn't
define a partial (ie conditional) UNIQUE constraint.

When trying to delete such a partial unique index, we get the error "Unique Constraint not found", so the standard command to remove $table->dropUnique() does not fit, the command $table->dropIndex() is suitable, but if pass the array there, then the index name will be generated as for a regular index with the suffix _index, instead of _unique, which we need.

And manually generating the index name is wrong.

This Merge Request solves these problems.

Added supporting USING and Default Expressions to Schema.

05 Aug 12:30
Compare
Choose a tag to compare

Add supporting views to Blueprint/Schema

01 Aug 10:57
Compare
Choose a tag to compare
Add support views (#4)

Adding support for creating views

Added to Schema supporting numeric types

31 Jul 09:45
Compare
Choose a tag to compare
Add numeric column type (#21)

This PR adds numeric column type to schema builder. that. unlike 'decimal' type can be with variable precision

Fix Connection Refused by artisan package:discover --ansi

17 Jul 10:55
Compare
Choose a tag to compare
Moving register extensions to PostgresConnections (#19)

Registration of user extensions is moved from UmbrellioPostgresProvider in PostgresConnection.

fix bug

17 Jul 10:14
Compare
Choose a tag to compare
2.2.5

tests fixes

Beta (Some fixes in tests)

17 Jul 09:41
Compare
Choose a tag to compare
2.2.2.2

tests fixes