feat(postgres): support macaddr8 column type

Signed-off-by: John Chan <john.chan@sgwireless.com>
This commit is contained in:
John Chan 2025-03-19 19:13:12 +08:00 committed by GitHub
parent 5d6d893662
commit b0ea913f4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 12 additions and 2 deletions

View File

@ -388,7 +388,7 @@ or
`character`, `char`, `text`, `citext`, `hstore`, `bytea`, `bit`, `varbit`, `bit varying`,
`timetz`, `timestamptz`, `timestamp`, `timestamp without time zone`, `timestamp with time zone`,
`date`, `time`, `time without time zone`, `time with time zone`, `interval`, `bool`, `boolean`,
`enum`, `point`, `line`, `lseg`, `box`, `path`, `polygon`, `circle`, `cidr`, `inet`, `macaddr`,
`enum`, `point`, `line`, `lseg`, `box`, `path`, `polygon`, `circle`, `cidr`, `inet`, `macaddr`, `macaddr8`,
`tsvector`, `tsquery`, `uuid`, `xml`, `json`, `jsonb`, `int4range`, `int8range`, `numrange`,
`tsrange`, `tstzrange`, `daterange`, `int4multirange`, `int8multirange`, `nummultirange`,
`tsmultirange`, `tstzmultirange`, `multidaterange`, `geometry`, `geography`, `cube`, `ltree`

View File

@ -274,7 +274,7 @@ TypeORM 支持所有最常用的数据库支持的列类型。
`character`, `char`, `text`, `citext`, `hstore`, `bytea`, `bit`, `varbit`, `bit varying`,
`timetz`, `timestamptz`, `timestamp`, `timestamp without time zone`, `timestamp with time zone`,
`date`, `time`, `time without time zone`, `time with time zone`, `interval`, `bool`, `boolean`,
`enum`, `point`, `line`, `lseg`, `box`, `path`, `polygon`, `circle`, `cidr`, `inet`, `macaddr`,
`enum`, `point`, `line`, `lseg`, `box`, `path`, `polygon`, `circle`, `cidr`, `inet`, `macaddr`, `macaddr8`,
`tsvector`, `tsquery`, `uuid`, `xml`, `json`, `jsonb`, `int4range`, `int8range`, `numrange`,
`tsrange`, `tstzrange`, `daterange`, `int4multirange`, `int8multirange`, `nummultirange`,
`tsmultirange`, `tstzmultirange`, `multidaterange`, `geometry`, `geography`

View File

@ -168,6 +168,7 @@ export class PostgresDriver implements Driver {
"cidr",
"inet",
"macaddr",
"macaddr8",
"tsvector",
"tsquery",
"uuid",

View File

@ -188,6 +188,7 @@ export type SimpleColumnType =
| "inet4" // mariadb
| "inet6" // mariadb
| "macaddr" // postgres
| "macaddr8" // postgres
| "bit" // postgres, mssql
| "bit varying" // postgres
| "varbit" // postgres

View File

@ -85,6 +85,7 @@ describe("database schema > column types > postgres", () => {
post.cidr = "192.168.100.128/25"
post.inet = "192.168.100.128"
post.macaddr = "08:00:2b:01:02:03"
post.macaddr8 = "08:00:2b:01:02:03:04:05"
post.bit = "1"
post.varbit = "100"
post.bitVarying = "00"
@ -178,6 +179,7 @@ describe("database schema > column types > postgres", () => {
loadedPost.cidr.should.be.equal(post.cidr)
loadedPost.inet.should.be.equal(post.inet)
loadedPost.macaddr.should.be.equal(post.macaddr)
loadedPost.macaddr8.should.be.equal(post.macaddr8)
loadedPost.bit.should.be.equal(post.bit)
loadedPost.varbit.should.be.equal(post.varbit)
loadedPost.bitVarying.should.be.equal(post.bitVarying)
@ -308,6 +310,9 @@ describe("database schema > column types > postgres", () => {
table!
.findColumnByName("macaddr")!
.type.should.be.equal("macaddr")
table!
.findColumnByName("macaddr8")!
.type.should.be.equal("macaddr8")
table!.findColumnByName("bit")!.type.should.be.equal("bit")
table!
.findColumnByName("varbit")!

View File

@ -175,6 +175,9 @@ export class Post {
@Column("macaddr")
macaddr: string
@Column("macaddr8")
macaddr8: string
// -------------------------------------------------------------------------
// Bit String Type
// -------------------------------------------------------------------------