This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>com.formkiq</groupId> | |
<artifactId>lambda-runtime-graalvm</artifactId> | |
<version>${lambdaRuntime.version}</version> | |
</dependency> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LambdaHandler implements RequestHandler<APIGatewayV2HTTPEvent, LambdaResponse> { | |
private static final Gson mapper = new Gson(); | |
private static final AstraClient astraClient = newAstraClientFromEnv(); | |
private static AstraClient newAstraClientFromEnv() { | |
String astraUrl = System.getenv("ASTRA_URL"); | |
String astraToken = System.getenv("ASTRA_TOKEN"); | |
String astraNamespace = System.getenv("ASTRA_NAMESPACE"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.amazonaws.auth.AWSCredentialsProvider | |
import com.amazonaws.auth.AWSSessionCredentials | |
import com.amazonaws.auth.BasicAWSCredentials | |
import com.amazonaws.auth.profile.internal.AllProfiles | |
import com.amazonaws.auth.profile.internal.AwsProfileNameLoader | |
import com.amazonaws.auth.profile.internal.BasicProfile | |
import com.amazonaws.auth.profile.internal.BasicProfileConfigLoader | |
import com.amazonaws.auth.profile.internal.ProfileAssumeRoleCredentialsProvider | |
import com.amazonaws.auth.profile.internal.ProfileStaticCredentialsProvider | |
import com.amazonaws.auth.profile.internal.securitytoken.STSProfileCredentialsServiceLoader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun testAfterMigration(postgresContainer: PostgresContainer, testFunction: suspend (PgClient) -> Unit) { | |
migrate(postgresContainer.connectionDetails) | |
val pgClient = createPgClient(postgresContainer.connectionDetails) | |
runBlocking { | |
testFunction(pgClient) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Testcontainers | |
class DatabaseMigrationsTest { | |
@Container | |
val postgresContainer = PostgresContainer("postgres:10.6") | |
.withDatabaseName("db") | |
.withUsername("user") | |
.withPassword("password") | |
@Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val (host, port, dbName, username, password) = getConnectionDetails() | |
val jdbcUrl = "jdbc:postgresql://$host:$port/$dbName" | |
Flyway.configure() | |
.dataSource(jdbcUrl, username, password) | |
.load() | |
.migrate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- V1.0.1__Customer_id_index.sql | |
create unique index customer_id | |
on customers (id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- V1.0.0__Customer_table.sql | |
create table customers ( | |
id int, | |
last_name varchar(255), | |
first_name varchar(255) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
└── src | |
└── main | |
└── resources | |
└── db_migrations | |
├── V1.0.0__Customer_table.sql | |
├── V1.0.1__Customer_id_index.sql | |
└── V2.0.0__Product_table.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 /sbin/init | |
| | |
+ ... | |
| | |
+-- 506 /usr/local/zeppelin | |
1 /usr/local/zeppelin | |
+-- 2 interpreter.sh | |
+-- 3 interpreter.sh | |
+-- 511 /usr/local/zeppelin | |
1 /usr/local/zeppelin |
NewerOlder