feat(db-postgres): add point field support (#9078)
### What? Adds full support for the point field to Postgres and Vercel Postgres adapters through the Postgis extension. Fully the same API as with MongoDB, including support for `near`, `within` and `intersects` operators. Additionally, exposes to adapter args: * `tablesFilter`https://orm.drizzle.team/docs/drizzle-kit-push#including-tables-schemas-and-extensions. * `extensions` list of extensions to create, for example `['vector', 'pg_search']`, `postgis` is created automatically if there's any point field ### Why? It's essential to support that field type, especially if the postgres adapter should be out of beta on 3.0 stable. ### How? * Bumps `drizzle-orm` to `0.36.1` and `drizzle-kit` to `0.28.0` as we need this change https://github.com/drizzle-team/drizzle-orm/pull/3141 * Uses its functions to achieve querying functionality, for example the `near` operator works through `ST_DWithin` or `intersects` through `ST_Intersects`. * Removes MongoDB condition from all point field tests, but keeps for SQLite Resolves these discussions: https://github.com/payloadcms/payload/discussions/8996 https://github.com/payloadcms/payload/discussions/8644
This commit is contained in:
@@ -25,6 +25,7 @@ export interface Config {
|
||||
'payload-preferences': PayloadPreference;
|
||||
'payload-migrations': PayloadMigration;
|
||||
};
|
||||
collectionsJoins: {};
|
||||
collectionsSelect: {
|
||||
posts: PostsSelect<false> | PostsSelect<true>;
|
||||
'default-values': DefaultValuesSelect<false> | DefaultValuesSelect<true>;
|
||||
@@ -106,6 +107,11 @@ export interface DefaultValue {
|
||||
defaultValue?: string | null;
|
||||
};
|
||||
select?: ('option0' | 'option1' | 'default') | null;
|
||||
/**
|
||||
* @minItems 2
|
||||
* @maxItems 2
|
||||
*/
|
||||
point?: [number, number] | null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
@@ -263,6 +269,7 @@ export interface CustomId {
|
||||
id: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
_status?: ('draft' | 'published') | null;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
@@ -400,6 +407,7 @@ export interface DefaultValuesSelect<T extends boolean = true> {
|
||||
defaultValue?: T;
|
||||
};
|
||||
select?: T;
|
||||
point?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
@@ -531,6 +539,7 @@ export interface CustomIdsSelect<T extends boolean = true> {
|
||||
id?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
_status?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
|
||||
Reference in New Issue
Block a user