forked from aejnsn/postgresify
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aaron Johnson
committed
Dec 16, 2015
1 parent
71a4bcd
commit af1a4a0
Showing
7 changed files
with
135 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/bootstrap/compiled.php | ||
.env.*.php | ||
.env.php | ||
.env | ||
/vendor | ||
composer.phar | ||
composer.lock | ||
.DS_Store | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "aejnsn/laravel-pgsql-types", | ||
"description": "Extended PostgreSQL Types for Laravel", | ||
"keywords": ["postgresql", "pgsql", "laravel", "types"], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Aaron Johnson", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"minimum-stability": "stable", | ||
"require": { | ||
"php": ">=5.5.9", | ||
"laravel/framework": "5.1.*" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "~4.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Aejnsn\LaravelPgsqlTypes; | ||
|
||
use Illuminate\Database\Connectors\ConnectionFactory; | ||
use Illuminate\Database\DatabaseServiceProvider as BaseDatabaseServiceProvider; | ||
|
||
class DatabaseServiceProvider extends BaseDatabaseServiceProvider | ||
{ | ||
public function register() | ||
{ | ||
$this->app->singleton('db.factory', function ($app) { | ||
return new ConnectionFactory($app); | ||
}); | ||
|
||
$this->app->singleton('db.factory', function ($app) { | ||
return new DatabaseManager($app, $app['db.factory']); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Aejnsn\LaravelPgsqlTypes; | ||
|
||
use Aejnsn\LaravelPgsqlTypes\Schema\Builder as SchemaBuilder; | ||
use Aejnsn\LaravelPgsqlTypes\Schema\Grammars\PostgresGrammar as AejnsnPostgresGrammar; | ||
use Illuminate\Database\PostgresConnection as BasePostgresConnection; | ||
use Illuminate\Database\Query\Processors\PostgresProcessor; | ||
|
||
class PostgresConnection extends BasePostgresConnection | ||
{ | ||
public function getSchemaBuilder() | ||
{ | ||
if (is_null($this->schemaGrammar)) { | ||
$this->useDefaultSchemaGrammar(); | ||
} | ||
return new SchemaBuilder($this); | ||
} | ||
|
||
protected function getDefaultSchemaGrammar() | ||
{ | ||
return $this->withTablePrefix(new AejnsnPostgresGrammar); | ||
} | ||
|
||
protected function getDefaultPostProcessor() | ||
{ | ||
return new PostgresProcessor; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Aejnsn\LaravelPgsqlTypes\Schema\Grammars; | ||
|
||
use Illuminate\Database\Schema\Blueprint as BaseBlueprint; | ||
|
||
class Blueprint extends BaseBlueprint | ||
{ | ||
protected function addFluentIndexes() | ||
{ | ||
foreach ($this->columns as $column) { | ||
foreach (['primary', 'unique', 'index'] as $index) { | ||
if ($column->$index === true) { | ||
$this->$index($column->name); | ||
continue 2; | ||
} elseif (isset($column->$index)) { | ||
$this->$index($column->name, $column->$index); | ||
continue 2; | ||
} | ||
} | ||
} | ||
} | ||
|
||
public function inet($column) | ||
{ | ||
return $this->addColumn('inet', $column); | ||
} | ||
|
||
public function point($column) | ||
{ | ||
return $this->addColumn('point', $column); | ||
} | ||
|
||
public function money($column) | ||
{ | ||
return $this->addColumn('money', $column); | ||
} | ||
|
||
public function dateRange($column) | ||
{ | ||
return $this->addColumn('daterange', $column); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Aejnsn\LaravelPgsqlTypes\Schema; | ||
|
||
class Builder extends Illuminate\Database\Schema\Builder | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Aejnsn\LaravelPgsqlTypes\Schema\Grammars; | ||
|
||
use Illuminate\Database\Grammar; | ||
|
||
class PostgresGrammar extends Grammar | ||
{ | ||
|
||
} |