diff --git a/fizz/README.md b/fizz/README.md index 0c57f505..665ad102 100644 --- a/fizz/README.md +++ b/fizz/README.md @@ -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` diff --git a/fizz/translators/mysql.go b/fizz/translators/mysql.go index 3dbfa877..b86c5e85 100644 --- a/fizz/translators/mysql.go +++ b/fizz/translators/mysql.go @@ -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 { @@ -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 diff --git a/fizz/translators/postgres.go b/fizz/translators/postgres.go index 6c73af88..e9c9b842 100644 --- a/fizz/translators/postgres.go +++ b/fizz/translators/postgres.go @@ -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 } diff --git a/fizz/translators/sqlite.go b/fizz/translators/sqlite.go index 1eede7a4..5d51b57c 100644 --- a/fizz/translators/sqlite.go +++ b/fizz/translators/sqlite.go @@ -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" diff --git a/soda/cmd/generate/model.go b/soda/cmd/generate/model.go index 7516a264..a67704d7 100644 --- a/soda/cmd/generate/model.go +++ b/soda/cmd/generate/model.go @@ -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" @@ -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" diff --git a/soda/cmd/version.go b/soda/cmd/version.go index b0ae5a30..e651aa3d 100644 --- a/soda/cmd/version.go +++ b/soda/cmd/version.go @@ -1,3 +1,3 @@ package cmd -const Version = "3.21.0" +const Version = "3.21.1"