Skip to content

Commit

Permalink
fix: use @SQLDatasource declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Feb 28, 2025
1 parent 0316215 commit fb27830
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
/**
* Annotation to specify a SQL datasource.
*
* This can be added anywhere in your application, but it is recommended to add it to a package-info.java file
* at the root of your package hierarchy.
* This can be added anywhere in your application.
*
*/
@Retention(RetentionPolicy.RUNTIME)
Expand Down
15 changes: 7 additions & 8 deletions jvm-runtime/jvm_hot_reload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,13 @@ func TestLifecycleJVM(t *testing.T) {
in.Call("echo", "hello", map[string]string{"name": "Bob"}, func(t testing.TB, response map[string]string) {
assert.Equal(t, "Bye, Bob!", response["message"])
}),
// Now lets add a database, add the ftl config
in.EditFile("echo", func(content []byte) []byte {
return []byte(`
quarkus.datasource.testdb.db-kind=postgresql
quarkus.hibernate-orm.datasource=testdb
`)
}, "src/main/resources/application.properties"),

// Now lets add the DB
in.IfLanguage("java", in.EditFile("echo", func(content []byte) []byte {
return []byte(strings.ReplaceAll(string(content), "@Export", "@Export\n\n@SQLDatasource(name = \"testdb\", type = SQLDatabaseType.POSTGRESQL)"))
}, "src/main/java/ftl/echo/Echo.java")),
in.IfLanguage("kotlin", in.EditFile("echo", func(content []byte) []byte {
return []byte(strings.ReplaceAll(string(content), "@Export", "@Export\n\n@SQLDatasource(name = \"testdb\", type = SQLDatabaseType.POSTGRESQL)"))
}, "src/main/kotlin/ftl/echo/Echo.kt")),
// Create a new datasource
in.Exec("ftl", "postgres", "new", "echo.testdb"),

Expand Down

0 comments on commit fb27830

Please sign in to comment.