Skip to content

Commit d63a7b2

Browse files
author
Dennis Labordus
committed
Small change.
Signed-off-by: Dennis Labordus <[email protected]>
1 parent c599438 commit d63a7b2

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

repository-postgresql/src/main/resources/org/lfenergy/compas/scl/data/repository/postgres/db/migration/V1_0__create_scl_file.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ create table scl_file (
1515
type varchar(3) not null,
1616
name varchar(255) not null,
1717
scl_data text not null,
18-
primary key (id, version)
18+
primary key (id, major_version, minor_version, patch_version)
1919
);
2020

2121
create index scl_file_type on scl_file(type);

repository-postgresql/src/test/java/org/lfenergy/compas/scl/data/repository/postgres/PostgreSQLServerJUnitExtension.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public class PostgreSQLServerJUnitExtension implements BeforeAllCallback, Extens
2424
private static final Logger LOGGER = LoggerFactory.getLogger(PostgreSQLServerJUnitExtension.class);
2525

2626
private static EmbeddedPostgres pg;
27-
private static DataSource dataSource;
2827

2928
// Gate keeper to prevent multiple Threads within the same routine
3029
private final static Lock lock = new ReentrantLock();
@@ -33,15 +32,12 @@ public class PostgreSQLServerJUnitExtension implements BeforeAllCallback, Extens
3332
public void beforeAll(final ExtensionContext context) throws Exception {
3433
// lock the access so only one Thread has access to it
3534
lock.lock();
36-
if (dataSource == null) {
35+
if (pg == null) {
3736
pg = EmbeddedPostgres.builder()
3837
.start();
3938

40-
// It does not matter which database it will be after all. We just use the default.
41-
dataSource = pg.getPostgresDatabase();
42-
4339
// We will also run Flyway to upgrade the database.
44-
CompasFlywayMigrator migrator = new CompasFlywayMigrator(dataSource);
40+
CompasFlywayMigrator migrator = new CompasFlywayMigrator(pg.getPostgresDatabase());
4541
migrator.migrate();
4642

4743
// The following line registers a callback hook when the root test context is shut down
@@ -61,6 +57,7 @@ public void close() {
6157
}
6258

6359
public static DataSource getDataSource() {
64-
return dataSource;
60+
// It does not matter which database it will be after all. We just use the default.
61+
return pg.getPostgresDatabase();
6562
}
6663
}

0 commit comments

Comments
 (0)