1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace LaravelSpatial\Schema\Grammars; |
4
|
|
|
|
5
|
|
|
use Illuminate\Database\Schema\Grammars\PostgresGrammar as BasePostgresGrammar; |
6
|
|
|
use Illuminate\Support\Fluent; |
7
|
|
|
use Illuminate\Database\Schema\Blueprint; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class PostgresGrammar |
11
|
|
|
* |
12
|
|
|
* @package LaravelSpatial\Schema\Grammars |
13
|
|
|
*/ |
14
|
|
|
class PostgresGrammar extends BasePostgresGrammar |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @inheritDoc |
18
|
|
|
*/ |
19
|
13 |
|
public function typePoint(Fluent $column) |
20
|
|
|
{ |
21
|
13 |
|
return parent::typePoint($column); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @inheritDoc |
26
|
|
|
*/ |
27
|
13 |
|
public function typeMultiPoint(Fluent $column) |
28
|
|
|
{ |
29
|
13 |
|
return parent::typeMultiPoint($column); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @inheritDoc |
34
|
|
|
*/ |
35
|
13 |
|
public function typePolygon(Fluent $column) |
36
|
|
|
{ |
37
|
13 |
|
return parent::typePolygon($column); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @inheritDoc |
42
|
|
|
*/ |
43
|
13 |
|
public function typeMultiPolygon(Fluent $column) |
44
|
|
|
{ |
45
|
13 |
|
return parent::typeMultiPolygon($column); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @inheritDoc |
50
|
|
|
*/ |
51
|
13 |
|
public function typeLineString(Fluent $column) |
52
|
|
|
{ |
53
|
13 |
|
return parent::typeLineString($column); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @inheritDoc |
58
|
|
|
*/ |
59
|
13 |
|
public function typeMultiLineString(Fluent $column) |
60
|
|
|
{ |
61
|
13 |
|
return parent::typeMultiLineString($column); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @inheritDoc |
66
|
|
|
*/ |
67
|
|
|
public function typeGeography(Fluent $column) |
68
|
|
|
{ |
69
|
|
|
return 'GEOGRAPHY'; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @inheritDoc |
74
|
|
|
*/ |
75
|
13 |
|
public function typeGeometry(Fluent $column) |
76
|
|
|
{ |
77
|
13 |
|
return parent::typeGeometry($column); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @inheritDoc |
82
|
|
|
*/ |
83
|
13 |
|
public function typeGeometryCollection(Fluent $column) |
84
|
|
|
{ |
85
|
13 |
|
return parent::typeGeometryCollection($column); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Adds a statement to create the postgis extension |
90
|
|
|
* |
91
|
|
|
* @param Blueprint $blueprint |
92
|
|
|
* @param Fluent $command |
93
|
|
|
* |
94
|
|
|
* @return string |
95
|
|
|
*/ |
96
|
1 |
|
public function compileEnablePostgis(Blueprint $blueprint, Fluent $command) |
97
|
|
|
{ |
98
|
1 |
|
return 'CREATE EXTENSION postgis'; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Adds a statement to drop the postgis extension |
103
|
|
|
* |
104
|
|
|
* @param Blueprint $blueprint |
105
|
|
|
* @param Fluent $command |
106
|
|
|
* @return string |
107
|
|
|
*/ |
108
|
1 |
|
public function compileDisablePostgis(Blueprint $blueprint, Fluent $command) |
109
|
|
|
{ |
110
|
1 |
|
return 'DROP EXTENSION postgis'; |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
|