Skip to content

Commit 257f4df

Browse files
authored
Merge pull request mstaack#77 from grimzy/extension-on-schema
Enable/Disable Postgis without a table
2 parents 64f279e + 88c3d10 commit 257f4df

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

src/Schema/Builder.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,28 @@ protected function createBlueprint($table, Closure $callback = null)
1515
{
1616
return new Blueprint($table, $callback);
1717
}
18+
19+
/**
20+
* Enable foreign key constraints.
21+
*
22+
* @return bool
23+
*/
24+
public function enablePostgis()
25+
{
26+
return $this->connection->statement(
27+
$this->grammar->compileEnablePostgis()
28+
);
29+
}
30+
31+
/**
32+
* Disable foreign key constraints.
33+
*
34+
* @return bool
35+
*/
36+
public function disablePostgis()
37+
{
38+
return $this->connection->statement(
39+
$this->grammar->compileDisablePostgis()
40+
);
41+
}
1842
}

src/Schema/Grammars/PostgisGrammar.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,19 @@ public function compileGeometrycollection(Blueprint $blueprint, Fluent $command)
100100
/**
101101
* Adds a statement to create the postgis extension
102102
*
103-
* @param Blueprint $blueprint
104-
* @param Fluent $command
105103
* @return string
106104
*/
107-
public function compileEnablePostgis(Blueprint $blueprint, Fluent $command)
105+
public function compileEnablePostgis()
108106
{
109107
return 'CREATE EXTENSION postgis';
110108
}
111109

112110
/**
113111
* Adds a statement to drop the postgis extension
114112
*
115-
* @param Blueprint $blueprint
116-
* @param Fluent $command
117113
* @return string
118114
*/
119-
public function compileDisablePostgis(Blueprint $blueprint, Fluent $command)
115+
public function compileDisablePostgis()
120116
{
121117
return 'DROP EXTENSION postgis';
122118
}

0 commit comments

Comments
 (0)