Skip to content

Default annotations aren't working if the default value is a literalΒ #3069

@Southclaws

Description

@Southclaws

The following field produces no default value:

field.Text("kyc_result").Annotations(&entsql.Annotation{Default: "'not_initiated'::text"}),

Whereas these produce the desired result:

...Annotations(&entsql.Annotation{Default: "CURRENT_TIMESTAMP"}),
...Annotations(&entsql.Annotation{Default: "gen_random_uuid()"})
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

image

Expected Behavior πŸ€”

image

Steps to Reproduce πŸ•Ή

Just spin up an example schema with a Text field that has an annotated default value as in the above snippet.

Your Environment 🌎

Tech Version
Go 1.19
Ent entgo.io/ent v0.11.5-0.20221105052850-a91aabe3ef4c
Database Postgres 13
Driver pgx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions