8
8
9
9
class MySqlGrammar extends IlluminateMySqlGrammar
10
10
{
11
+ /**
12
+ * The possible column modifiers.
13
+ *
14
+ * @var array
15
+ */
16
+ // protected $modifiers = [
17
+ // 'Unsigned', 'Charset', 'Collate', 'VirtualAs', 'StoredAs', 'Nullable',
18
+ // 'Default', 'Increment', 'Comment', 'After', 'First', 'Srid',
19
+ // ];
20
+
21
+ public function __construct ()
22
+ {
23
+ $ this ->modifiers [] = 'Srid ' ;
24
+ }
25
+
11
26
/**
12
27
* Adds a statement to add a geometry column.
13
28
*
14
- * @param \Illuminate\Support\ Fluent $column
29
+ * @param Fluent $column
15
30
*
16
31
* @return string
17
32
*/
@@ -23,7 +38,7 @@ public function typeGeometry(Fluent $column)
23
38
/**
24
39
* Adds a statement to add a point column.
25
40
*
26
- * @param \Illuminate\Support\ Fluent $column
41
+ * @param Fluent $column
27
42
*
28
43
* @return string
29
44
*/
@@ -35,7 +50,7 @@ public function typePoint(Fluent $column)
35
50
/**
36
51
* Adds a statement to add a linestring column.
37
52
*
38
- * @param \Illuminate\Support\ Fluent $column
53
+ * @param Fluent $column
39
54
*
40
55
* @return string
41
56
*/
@@ -47,7 +62,7 @@ public function typeLinestring(Fluent $column)
47
62
/**
48
63
* Adds a statement to add a polygon column.
49
64
*
50
- * @param \Illuminate\Support\ Fluent $column
65
+ * @param Fluent $column
51
66
*
52
67
* @return string
53
68
*/
@@ -59,7 +74,7 @@ public function typePolygon(Fluent $column)
59
74
/**
60
75
* Adds a statement to add a multipoint column.
61
76
*
62
- * @param \Illuminate\Support\ Fluent $column
77
+ * @param Fluent $column
63
78
*
64
79
* @return string
65
80
*/
@@ -71,7 +86,7 @@ public function typeMultipoint(Fluent $column)
71
86
/**
72
87
* Adds a statement to add a multilinestring column.
73
88
*
74
- * @param \Illuminate\Support\ Fluent $column
89
+ * @param Fluent $column
75
90
*
76
91
* @return string
77
92
*/
@@ -83,7 +98,7 @@ public function typeMultilinestring(Fluent $column)
83
98
/**
84
99
* Adds a statement to add a multipolygon column.
85
100
*
86
- * @param \Illuminate\Support\ Fluent $column
101
+ * @param Fluent $column
87
102
*
88
103
* @return string
89
104
*/
@@ -95,7 +110,7 @@ public function typeMultipolygon(Fluent $column)
95
110
/**
96
111
* Adds a statement to add a geometrycollection column.
97
112
*
98
- * @param \Illuminate\Support\ Fluent $column
113
+ * @param Fluent $column
99
114
*
100
115
* @return string
101
116
*/
@@ -107,13 +122,28 @@ public function typeGeometrycollection(Fluent $column)
107
122
/**
108
123
* Compile a spatial index key command.
109
124
*
110
- * @param \Grimzy\LaravelMysqlSpatial\Schema\ Blueprint $blueprint
111
- * @param \Illuminate\Support\ Fluent $command
125
+ * @param Blueprint $blueprint
126
+ * @param Fluent $command
112
127
*
113
128
* @return string
114
129
*/
115
130
public function compileSpatial (Blueprint $ blueprint , Fluent $ command )
116
131
{
117
132
return $ this ->compileKey ($ blueprint , $ command , 'spatial ' );
118
133
}
134
+
135
+ /**
136
+ * Get the SQL for a SRID column modifier.
137
+ *
138
+ * @param Blueprint $blueprint
139
+ * @param Fluent $column
140
+ *
141
+ * @return string|null
142
+ */
143
+ protected function modifySrid (Blueprint $ blueprint , Fluent $ column )
144
+ {
145
+ if (!is_null ($ column ->srid ) && is_int ($ column ->srid ) && $ column ->srid > 0 ) {
146
+ return ' srid ' .$ column ->srid ;
147
+ }
148
+ }
119
149
}
0 commit comments