Re: Duplicate table in jooq with foreignkey and primary key

2020-03-26 Thread Lukas Eder
For the record, this question was also asked on Stack 
Overflow: https://stackoverflow.com/q/60848882/521799

On Wednesday, March 25, 2020 at 2:26:26 PM UTC+1, Lukas Eder wrote:
>
> Hi Giuseppe,
>
> If you're using the code generator to produce your original schema, you 
> can duplicate it relatively easily using:
>
> - Runtime schema mapping: 
> https://www.jooq.org/doc/latest/manual/code-generation/codegen-advanced/codegen-config-database/codegen-database-catalog-and-schema-mapping/
> - DSLContext.ddl() and/or Meta.ddl()
>
> A more convenient syntax will be supported in the future via standard SQL 
> CREATE TABLE (.. LIKE othertable) syntax:
> https://github.com/jOOQ/jOOQ/issues/8860 
>
> Or a synthetic CREATE SCHEMA .. LIKE otherschema syntax:
> https://github.com/jOOQ/jOOQ/issues/9527 
>
> This is a very interesting use-case to pursue in the future of jOOQ, so if 
> you encounter any issues, please do report them.
>
> I hope this helps,
> Lukas
>
> On Wed, Mar 25, 2020 at 1:41 PM  wrote:
>
>> Hi everyone,
>>
>> i have a question, i duplicated a table with:
>>
>> Table table = DSL.table(DSL.name("dc2", "process"));
>> 
>> dsl.createTable(table).as(dsl.select().from("dc1.process")).withNoData().execute();
>>
>> but doesn't copy a primary key and foreignkey, how i do?
>>
>> and if i want to duplicate schema in jooq? thanks Giuseppe
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "jOOQ User Group" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jooq-user+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jooq-user/104c349b-4add-472d-97ac-01921da2c131%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jooq-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/9024d3b4-a717-4f07-8a60-b2624789e8d3%40googlegroups.com.


Re: Duplicate table in jooq with foreignkey and primary key

2020-03-25 Thread Lukas Eder
Hi Giuseppe,

If you're using the code generator to produce your original schema, you can
duplicate it relatively easily using:

- Runtime schema mapping:
https://www.jooq.org/doc/latest/manual/code-generation/codegen-advanced/codegen-config-database/codegen-database-catalog-and-schema-mapping/
- DSLContext.ddl() and/or Meta.ddl()

A more convenient syntax will be supported in the future via standard SQL
CREATE TABLE (.. LIKE othertable) syntax:
https://github.com/jOOQ/jOOQ/issues/8860

Or a synthetic CREATE SCHEMA .. LIKE otherschema syntax:
https://github.com/jOOQ/jOOQ/issues/9527

This is a very interesting use-case to pursue in the future of jOOQ, so if
you encounter any issues, please do report them.

I hope this helps,
Lukas

On Wed, Mar 25, 2020 at 1:41 PM  wrote:

> Hi everyone,
>
> i have a question, i duplicated a table with:
>
> Table table = DSL.table(DSL.name("dc2", "process"));
> 
> dsl.createTable(table).as(dsl.select().from("dc1.process")).withNoData().execute();
>
> but doesn't copy a primary key and foreignkey, how i do?
>
> and if i want to duplicate schema in jooq? thanks Giuseppe
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jooq-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jooq-user/104c349b-4add-472d-97ac-01921da2c131%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jooq-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/CAB4ELO4aROcq_JYR8-eWc7fNMNm4w%2Bw2DZUpod_TgD%2BRwguovA%40mail.gmail.com.


Duplicate table in jooq with foreignkey and primary key

2020-03-25 Thread iz8wok


Hi everyone,

i have a question, i duplicated a table with:

Table table = DSL.table(DSL.name("dc2", "process"));

dsl.createTable(table).as(dsl.select().from("dc1.process")).withNoData().execute();

but doesn't copy a primary key and foreignkey, how i do?

and if i want to duplicate schema in jooq? thanks Giuseppe

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jooq-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/104c349b-4add-472d-97ac-01921da2c131%40googlegroups.com.