Skip to content

Commit

Permalink
added some aliases for timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Jun 6, 2017
1 parent 4468fbc commit 5a6606f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion fizz/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Columns all have the same syntax. First is the name of the column. Second is the

* `string`
* `text`
* `timestamp`
* `timestamp`, `time`, `datetime`
* `integer`
* `boolean`

Expand Down
4 changes: 2 additions & 2 deletions fizz/translators/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (p *MySQL) buildColumn(c fizz.Column) string {
}

func (p *MySQL) colType(c fizz.Column) string {
switch c.ColType {
switch strings.ToLower(c.ColType) {
case "string":
s := "255"
if c.Options["size"] != nil {
Expand All @@ -160,7 +160,7 @@ func (p *MySQL) colType(c fizz.Column) string {
return fmt.Sprintf("VARCHAR (%s)", s)
case "uuid":
return "char(36)"
case "timestamp":
case "timestamp", "time", "datetime":
return "DATETIME"
default:
return c.ColType
Expand Down
2 changes: 2 additions & 0 deletions fizz/translators/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ func (p *Postgres) colType(c fizz.Column) string {
return fmt.Sprintf("VARCHAR (%s)", s)
case "uuid":
return "UUID"
case "time", "datetime":
return "timestamp"
default:
return c.ColType
}
Expand Down
6 changes: 3 additions & 3 deletions fizz/translators/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,12 @@ func (p *SQLite) buildColumn(c fizz.Column) string {
}

func (p *SQLite) colType(c fizz.Column) string {
switch c.ColType {
switch strings.ToLower(c.ColType) {
case "uuid":
return "char(36)"
case "timestamp":
case "timestamp", "time", "datetime":
return "DATETIME"
case "boolean", "DATE":
case "boolean", "date":
return "NUMERIC"
case "string":
return "TEXT"
Expand Down
4 changes: 2 additions & 2 deletions soda/cmd/generate/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func colType(s string) string {
switch s {
case "text":
return "string"
case "time", "timestamp":
case "time", "timestamp", "datetime":
return "time.Time"
case "nulls.Text":
return "nulls.String"
Expand All @@ -202,7 +202,7 @@ func fizzColType(s string) string {
switch strings.ToLower(s) {
case "int":
return "integer"
case "time":
case "time", "datetime":
return "timestamp"
case "uuid.uuid", "uuid":
return "uuid"
Expand Down
2 changes: 1 addition & 1 deletion soda/cmd/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package cmd

const Version = "3.21.0"
const Version = "3.21.1"

0 comments on commit 5a6606f

Please sign in to comment.