How to create a field with postgres schema definition

According to the docs it should be possible to define a pg schema: Fields | Directus Docs

However when i try to create a timestamp without time zone it is nevertheless created as timestamp with time zone

My schema definition looks like this:

{
   field: 'time_of_call',
   type: 'timestamp',
   schema: {
      default_value: null,
      is_nullable: true,
      schema: 'timestamp without time zone'
    },
    meta: {
       interface: 'datetime',
       display: 'datetime',
       display_options: {
           format: '24h'
        },
        note: 'Original datetime value from source'
     }
}

Am I doing that wrong?
Or is rather my vibe partner right, concluding, that Directus is simply ignoring the pg schema.

Thx in advance for digging into this.

1 Answer

1

Turns out that dateTime defaults to timestamp without time zone while timestamp defaults to timestamp with time zone on postgres.

This definition is working now for me:

{
	field: 'time_of_call',
	type: 'dateTime',
	schema: {
		default_value: null,
		is_nullable: true
	},
	meta: {
		interface: 'datetime',
		display: 'datetime',
		display_options: {
			format: '24h',
		},
		note: 'Original datetime value from source',
	}
}

Doesn’t answer the initial question, tho, how to define a specific postgres field type.

There's no way to define a specific Postgres type, as Directus abstracts away the data types to work across all databases