Skip to content

Commit 0400406

Browse files
committed
Add varchar support
1 parent 6bd2396 commit 0400406

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

postgres/schema.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ func (c Column) GoType() string {
3030
return "int"
3131
case "pg_catalog.timestamp":
3232
return "time.Time"
33+
case "pg_catalog.varchar":
34+
if c.NotNull {
35+
return "string"
36+
} else {
37+
return "sql.NullString"
38+
}
3339
default:
3440
return "interface{}"
3541
}

testdata/ondeck/schema/0002_venue.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
CREATE TABLE venues (
22
id SERIAL primary key,
33
dropped text,
4-
slug text not null,
5-
name text not null,
6-
city text references city(slug),
7-
spotify_playlist text not null,
4+
slug text not null,
5+
name varchar(255) not null,
6+
city text references city(slug),
7+
spotify_playlist varchar not null,
88
songkick_id text
99
)

0 commit comments

Comments
 (0)