Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add schema configuration option for jooq LockProvider class #1830

Closed
vaibhavsrivastava17594 opened this issue Mar 11, 2024 · 4 comments
Closed

Comments

@vaibhavsrivastava17594
Copy link

vaibhavsrivastava17594 commented Mar 11, 2024

Is your feature request related to a problem? Please describe.
I am trying to configure LockProvider to use a custom schema "orchestrator" to access my Shedlock table, but unfortunately I am unable to see any such setting in Shedlock LockProvider for jooq.

Describe the solution you'd like
Setting that is similar to what is present for JDBC.

new JdbcTemplateLockProvider(builder()
    .withTableName("shdlck")
    .withColumnNames(new ColumnNames("n", "lck_untl", "lckd_at", "lckd_by"))
    .withJdbcTemplate(new JdbcTemplate(getDatasource()))
    .withLockedByValue("my-value")
    .withDbUpperCase(true)
    .build())
    
new JdbcTemplateLockProvider(datasource, "my_schema.shedlock")    

Additional context
My shedlock table creation script:

CREATE TABLE orchestrator.shedlock(
      name                   VARCHAR(64)             NOT NULL,
      lock_until             TIMESTAMP               NOT NULL,
      locked_at             TIMESTAMP                NOT NULL,
      locked_by             VARCHAR(255)             NOT NULL,
      PRIMARY KEY (name)
);
@lukas-krecan
Copy link
Owner

@vaibhavsrivastava17594
Copy link
Author

I tried this suggestion while creating Settings object but it still looks up shedlock table from public schema. Below are my changes:

    @Bean
    open fun jooqSettings(): Settings = Settings()
        .withRenderQuotedNames(RenderQuotedNames.EXPLICIT_DEFAULT_UNQUOTED)
        .withRenderNameCase(RenderNameCase.LOWER_IF_UNQUOTED)
        .withRenderMapping(RenderMapping()
        .withSchemata(
             MappedSchema().withInput("public") //Default schema
                 .withOutput("orchestrator") //My target schema where I want the shedlock table to be used from
                 .withTables(
                    MappedTable().withInput("shedlock")
                        .withOutput("shedlock"))))

@lukas-krecan
Copy link
Owner

Hi, I do not think "public" is the right default, can you try specifying ""?

@lukas-krecan
Copy link
Owner

lukas-krecan commented Mar 22, 2024

This works for me:

MappedSchema().withInput("") //Default schema
 .withOutput("orchestrator") //My target schema where I want the shedlock table to be used from

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants