Describe the feature

Allow for an AutoMigrateType function, that can take a struct and translate it to a composite type.

Convert the following:

type AnimalGroups struct {
    Cats  int
    Dogs  int
    Birds int
}
db.AutoMigrateType(AnimalGroups{})

to postgres sql:

create type animalgroups as
(
    cats       integer,
    dogs       integer,
    birds      integer
);

And subsequently, convert following:

type AnimalGroups struct {
      Cats   int
      Dogs   int
      Birds  int
      Total  int  // <-- added property
}
db.AutoMigrateType(AnimalGroups{})

to postgres sql:

alter type animalgroups add attribute total integer

Motivation

This simplifies management of types since composite types can not be replaced but instead must be altered. Which must be managed by the developer by manually writing alter statements.

considerations: - Derive Scanner / Value implementation based on the type - Support for dropping attributes - struct tag for default values / checks - attribute order should be preserver in SQL types

Comment From: github-actions[bot]

This issue has been automatically marked as stale because it has been open 360 days with no activity. Remove stale label or comment or this will be closed in 180 days

Comment From: helmus

@saeidee is there a PR for this ?

Comment From: saeidee

This feature request is not considered to be implemented, we need more developer requests to implement this feature, or please feel free to submit a feature PR.