Completed
Branch testing (d1ef2e)
by Hennik
07:20 queued 02:29
created

PostgresGrammar::typeGeometrycollection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace LaravelSpatial\Schema\Grammars;
4
5
use Illuminate\Support\Fluent;
6
use LaravelSpatial\Schema\Blueprint;
7
8
class PostgresGrammar extends \Illuminate\Database\Schema\Grammars\PostgresGrammar
9
{
10
    /**
11
     * Adds a statement to add a point geometry column
12
     *
13
     * @param \Illuminate\Support\Fluent $column
14
     * @return string
15
     */
16 13
    public function typePoint(Fluent $column)
17
    {
18 13
        return 'GEOGRAPHY(POINT, 4326)';
19
    }
20
21
    /**
22
     * Adds a statement to add a point geometry column
23
     *
24
     * @param \Illuminate\Support\Fluent $column
25
     * @return string
26
     */
27 13
    public function typeMultipoint(Fluent $column)
28
    {
29 13
        return 'GEOGRAPHY(MULTIPOINT, 4326)';
30
    }
31
32
    /**
33
     * Adds a statement to add a polygon geometry column
34
     *
35
     * @param \Illuminate\Support\Fluent $column
36
     * @return string
37
     */
38 13
    public function typePolygon(Fluent $column)
39
    {
40 13
        return 'GEOGRAPHY(POLYGON, 4326)';
41
    }
42
43
    /**
44
     * Adds a statement to add a multipolygon geometry column
45
     *
46
     * @param \Illuminate\Support\Fluent $column
47
     * @return string
48
     */
49 13
    public function typeMultipolygon(Fluent $column)
50
    {
51 13
        return 'GEOGRAPHY(MULTIPOLYGON, 4326)';
52
    }
53
54
    /**
55
     * Adds a statement to add a linestring geometry column
56
     *
57
     * @param \Illuminate\Support\Fluent $column
58
     * @return string
59
     */
60 13
    public function typeLinestring(Fluent $column)
61
    {
62 13
        return 'GEOGRAPHY(LINESTRING, 4326)';
63
    }
64
65
    /**
66
     * Adds a statement to add a multilinestring geometry column
67
     *
68
     * @param \Illuminate\Support\Fluent $column
69
     * @return string
70
     */
71 13
    public function typeMultilinestring(Fluent $column)
72
    {
73 13
        return 'GEOGRAPHY(MULTILINESTRING, 4326)';
74
    }
75
76
    /**
77
     * Adds a statement to add a linestring geometry column
78
     *
79
     * @param \Illuminate\Support\Fluent $column
80
     * @return string
81
     */
82
    public function typeGeography(Fluent $column)
83
    {
84
        return 'GEOGRAPHY';
85
    }
86
87
    /**
88
     * Adds a statement to add a geometry geometry column
89
     *
90
     * @param Fluent $column
91
     * @return string
92
     */
93 13
    public function typeGeometry(Fluent $column)
94
    {
95 13
        return 'GEOGRAPHY(GEOMETRY, 4326)';
96
    }
97
98
    /**
99
     * Adds a statement to add a geometrycollection geometry column
100
     *
101
     * @param Fluent $column
102
     * @return string
103
     */
104 13
    public function typeGeometrycollection(Fluent $column)
105
    {
106 13
        return 'GEOGRAPHY(GEOMETRYCOLLECTION, 4326)';
107
    }
108
109
    /**
110
     * Adds a statement to create the postgis extension
111
     *
112
     * @param Blueprint $blueprint
113
     * @param Fluent $command
114
     * @return string
115
     */
116 1
    public function compileEnablePostgis(Blueprint $blueprint, Fluent $command)
117
    {
118 1
        return 'CREATE EXTENSION postgis';
119
    }
120
121
    /**
122
     * Adds a statement to drop the postgis extension
123
     *
124
     * @param Blueprint $blueprint
125
     * @param Fluent $command
126
     * @return string
127
     */
128 1
    public function compileDisablePostgis(Blueprint $blueprint, Fluent $command)
129
    {
130 1
        return 'DROP EXTENSION postgis';
131
    }
132
}
133