Skip to content

Commit 5a6606f

Browse files
committed
added some aliases for timestamp
1 parent 4468fbc commit 5a6606f

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

fizz/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Columns all have the same syntax. First is the name of the column. Second is the
2424

2525
* `string`
2626
* `text`
27-
* `timestamp`
27+
* `timestamp`, `time`, `datetime`
2828
* `integer`
2929
* `boolean`
3030

fizz/translators/mysql.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func (p *MySQL) buildColumn(c fizz.Column) string {
151151
}
152152

153153
func (p *MySQL) colType(c fizz.Column) string {
154-
switch c.ColType {
154+
switch strings.ToLower(c.ColType) {
155155
case "string":
156156
s := "255"
157157
if c.Options["size"] != nil {
@@ -160,7 +160,7 @@ func (p *MySQL) colType(c fizz.Column) string {
160160
return fmt.Sprintf("VARCHAR (%s)", s)
161161
case "uuid":
162162
return "char(36)"
163-
case "timestamp":
163+
case "timestamp", "time", "datetime":
164164
return "DATETIME"
165165
default:
166166
return c.ColType

fizz/translators/postgres.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ func (p *Postgres) colType(c fizz.Column) string {
144144
return fmt.Sprintf("VARCHAR (%s)", s)
145145
case "uuid":
146146
return "UUID"
147+
case "time", "datetime":
148+
return "timestamp"
147149
default:
148150
return c.ColType
149151
}

fizz/translators/sqlite.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,12 @@ func (p *SQLite) buildColumn(c fizz.Column) string {
304304
}
305305

306306
func (p *SQLite) colType(c fizz.Column) string {
307-
switch c.ColType {
307+
switch strings.ToLower(c.ColType) {
308308
case "uuid":
309309
return "char(36)"
310-
case "timestamp":
310+
case "timestamp", "time", "datetime":
311311
return "DATETIME"
312-
case "boolean", "DATE":
312+
case "boolean", "date":
313313
return "NUMERIC"
314314
case "string":
315315
return "TEXT"

soda/cmd/generate/model.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func colType(s string) string {
184184
switch s {
185185
case "text":
186186
return "string"
187-
case "time", "timestamp":
187+
case "time", "timestamp", "datetime":
188188
return "time.Time"
189189
case "nulls.Text":
190190
return "nulls.String"
@@ -202,7 +202,7 @@ func fizzColType(s string) string {
202202
switch strings.ToLower(s) {
203203
case "int":
204204
return "integer"
205-
case "time":
205+
case "time", "datetime":
206206
return "timestamp"
207207
case "uuid.uuid", "uuid":
208208
return "uuid"

soda/cmd/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package cmd
22

3-
const Version = "3.21.0"
3+
const Version = "3.21.1"

0 commit comments

Comments
 (0)