I believe "native" on the generator should generate a sequence in
PostgreSQL.

I don't know if NHibernate can generate "CREATE TYPE". I have never
actually used the schema generation in a production scenario, preferring to
write the SQL schema upgrade scripts manually instead, as this is the only
way to handle any data migration logic beyond adding new columns and tables.

/Oskar


Den mån 10 dec. 2018 kl 11:22 skrev <[email protected]>:

> Hello
>
> Can you please help us?
> We are working on a C# project, which heavily relies on nHibernate and we
> need to migrate from *MySQL* to *Postgres*. nHibernate makes this process
> rather easy, however there are some questions that we can’t find answers
> for…
>
> The first problem we’ve encountered is foreign keys. We have a lot of
> tables with one-to-one references with the following options:
> *On Update = CASCADE*
> *On Delete = RESTRICT*
>
> however Hibernate Attributes Mapping *Key* property attribute *OnDelete*
> doesn’t have the *restrict* option and there is no *OnUpdate* attribute…
> So what should we do - is manual foreign keys addition the only way?
>
> Another issue is Auto Increment - how should we enable it in case of
> *Postgresql* with nHibernate attributes? This is what we are using now:
>
> private int id;
> [Id(0, Column = “id”, Name = “Id”)]
> [Generator(1, Class = “native”)]
> public virtual int ID { get { return id; } }
>
> Last question is related to *ENUM* types - how can we make nHibernate to
> generate requests like *CREATE TYPE* type_enum AS ENUM (‘A’,‘B’); and
> using them in the INSERT / UPDATE sql requests?
>
> Thank you
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to