Schema and table name customization #420

Closed
ilx opened this Issue May 17, 2013 · 5 comments

Comments

Projects
None yet
2 participants
@ilx

ilx commented May 17, 2013

Please support following scenario:

  • user defines tables that start with prefix T_ in SCHEMA_A
  • user defines public synonyms for tables from SCHEMA_A in SCHEMA_B, and removes prefix T_ in the process

Now, user can create metadata from T_* tables in schema SCHEMA_A, but in runtime user has to use synonyms from SCHEMA_B.

There are two solutions:

  • allow generator to rename schema and tables in generated code
  • support schema and table name customization in the runtime
@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest May 19, 2013

Member

The runtime option is more flexible, so I will start sketching it.

Maybe configuration options in the Configuration class could work.

Member

timowest commented May 19, 2013

The runtime option is more flexible, so I will start sketching it.

Maybe configuration options in the Configuration class could work.

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest May 20, 2013

Member

Overrides can now be registered via the Configuration class

    Configuration configuration = new Configuration(new H2Templates());
    configuration.registerSchemaOverride("public", "pub");
    configuration.registerTableOverride("employee", "emp");
    configuration.registerTableOverride("public", "employee", "employees");

    assertEquals("pub", configuration.getSchema("public"));
    assertEquals("emp", configuration.getTable("", "employee"));
    assertEquals("employees", configuration.getTable("public", "employee"));
Member

timowest commented May 20, 2013

Overrides can now be registered via the Configuration class

    Configuration configuration = new Configuration(new H2Templates());
    configuration.registerSchemaOverride("public", "pub");
    configuration.registerTableOverride("employee", "emp");
    configuration.registerTableOverride("public", "employee", "employees");

    assertEquals("pub", configuration.getSchema("public"));
    assertEquals("emp", configuration.getTable("", "employee"));
    assertEquals("employees", configuration.getTable("public", "employee"));
@ilx

This comment has been minimized.

Show comment
Hide comment
@ilx

ilx May 22, 2013

Cool, thanks!
When can we expect it in the snapshots?

ilx commented May 22, 2013

Cool, thanks!
When can we expect it in the snapshots?

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest May 22, 2013

Member

It's now available in the 3.1.2.BUILD-SNAPSHOT

Member

timowest commented May 22, 2013

It's now available in the 3.1.2.BUILD-SNAPSHOT

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest May 27, 2013

Member

Released in 3.2.0

Member

timowest commented May 27, 2013

Released in 3.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment