I have this column in my typeORM entity :
<code> @Index({ spatial: true })
@Column({
type: 'geography',
spatialFeatureType: 'Point',
srid: 4326,
})
geolocation!: Point;
</code>
<code> @Index({ spatial: true })
@Column({
type: 'geography',
spatialFeatureType: 'Point',
srid: 4326,
})
geolocation!: Point;
</code>
@Index({ spatial: true })
@Column({
type: 'geography',
spatialFeatureType: 'Point',
srid: 4326,
})
geolocation!: Point;
I’m using pg-mem for my tests
But on init it crashes with this error
<code> 1 CREATE TABLE "user" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "geolocation" geography(Point,4326), ...(other columns)
Unexpected word token: "point". Instead, I was expecting to see one of the following:
- A "int" token
</code>
<code> 1 CREATE TABLE "user" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "geolocation" geography(Point,4326), ...(other columns)
Unexpected word token: "point". Instead, I was expecting to see one of the following:
- A "int" token
</code>
1 CREATE TABLE "user" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "geolocation" geography(Point,4326), ...(other columns)
Unexpected word token: "point". Instead, I was expecting to see one of the following:
- A "int" token
So basically you can register equivalent type but I could not make it work so far.
I’m not sure if you are supposed to register the type in postgis or directly in public so i tried both.
So fat none of these have worked.
<code>db.registerExtension('postgis', schema => {
schema.registerEquivalentType({
name: 'geography',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: 'geography(Point,4326)',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: 'point',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: 'Point',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: 'Point,4326',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: '(Point, 4326)',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
});
db.public.registerEquivalentType({
name: 'geography',
equivalentTo: DataType.point,
isValid: () => true,
});
db.public.registerEquivalentType({
name: 'geography(Point,4326)',
equivalentTo: DataType.point,
isValid: () => true,
});
db.public.registerEquivalentType({
name: 'point',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
db.public.registerEquivalentType({
name: 'Point',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
db.public.registerEquivalentType({
name: 'Point,4326',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
db.public.registerEquivalentType({
name: '(Point, 4326)',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
</code>
<code>db.registerExtension('postgis', schema => {
schema.registerEquivalentType({
name: 'geography',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: 'geography(Point,4326)',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: 'point',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: 'Point',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: 'Point,4326',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: '(Point, 4326)',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
});
db.public.registerEquivalentType({
name: 'geography',
equivalentTo: DataType.point,
isValid: () => true,
});
db.public.registerEquivalentType({
name: 'geography(Point,4326)',
equivalentTo: DataType.point,
isValid: () => true,
});
db.public.registerEquivalentType({
name: 'point',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
db.public.registerEquivalentType({
name: 'Point',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
db.public.registerEquivalentType({
name: 'Point,4326',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
db.public.registerEquivalentType({
name: '(Point, 4326)',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
</code>
db.registerExtension('postgis', schema => {
schema.registerEquivalentType({
name: 'geography',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: 'geography(Point,4326)',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: 'point',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: 'Point',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: 'Point,4326',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
schema.registerEquivalentType({
name: '(Point, 4326)',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
});
db.public.registerEquivalentType({
name: 'geography',
equivalentTo: DataType.point,
isValid: () => true,
});
db.public.registerEquivalentType({
name: 'geography(Point,4326)',
equivalentTo: DataType.point,
isValid: () => true,
});
db.public.registerEquivalentType({
name: 'point',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
db.public.registerEquivalentType({
name: 'Point',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
db.public.registerEquivalentType({
name: 'Point,4326',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
db.public.registerEquivalentType({
name: '(Point, 4326)',
equivalentTo: DataType.point,
isValid: geo => geo !== null && geo !== undefined,
});
Could anyone make this work ? It basically ruins all my test