-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
256 additions
and
96 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
dist: xenial | ||
language: generic | ||
|
||
services: | ||
- mongodb | ||
|
||
jdk: | ||
- openjdk11 | ||
|
||
|
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
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
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
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
64 changes: 0 additions & 64 deletions
64
src/main/java/nl/dtls/adminpanel/database/fixtures/DummyDataLoader.java
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
src/main/java/nl/dtls/adminpanel/database/migration/development/MigrationRunner.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package nl.dtls.adminpanel.database.migration.development; | ||
|
||
import javax.annotation.PostConstruct; | ||
import nl.dtls.adminpanel.Profiles; | ||
import nl.dtls.adminpanel.database.migration.development.application.ApplicationMigration; | ||
import nl.dtls.adminpanel.database.migration.development.instance.InstanceMigration; | ||
import nl.dtls.adminpanel.database.migration.development.server.ServerMigration; | ||
import nl.dtls.adminpanel.database.migration.development.user.UserMigration; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@Profile(Profiles.NON_PRODUCTION) | ||
public class MigrationRunner { | ||
|
||
@Autowired | ||
private UserMigration userMigration; | ||
|
||
@Autowired | ||
private ApplicationMigration applicationMigration; | ||
|
||
@Autowired | ||
private ServerMigration serverMigration; | ||
|
||
@Autowired | ||
private InstanceMigration instanceMigration; | ||
|
||
@PostConstruct | ||
public void run() { | ||
userMigration.runMigration(); | ||
applicationMigration.runMigration(); | ||
serverMigration.runMigration(); | ||
instanceMigration.runMigration(); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
...a/nl/dtls/adminpanel/database/migration/development/application/ApplicationMigration.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package nl.dtls.adminpanel.database.migration.development.application; | ||
|
||
import nl.dtls.adminpanel.database.migration.development.application.data.ApplicationFixtures; | ||
import nl.dtls.adminpanel.database.migration.development.common.Migration; | ||
import nl.dtls.adminpanel.database.repository.ApplicationRepository; | ||
import nl.dtls.adminpanel.entity.Application; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class ApplicationMigration implements Migration { | ||
|
||
@Autowired | ||
private ApplicationFixtures applicationFixtures; | ||
|
||
@Autowired | ||
private ApplicationRepository applicationRepository; | ||
|
||
public void runMigration() { | ||
applicationRepository.deleteAll(); | ||
Application fdpApplication = applicationFixtures.fdpApplication(); | ||
applicationRepository.save(fdpApplication); | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...se/fixtures/data/ApplicationFixtures.java → ...application/data/ApplicationFixtures.java
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
7 changes: 7 additions & 0 deletions
7
src/main/java/nl/dtls/adminpanel/database/migration/development/common/Migration.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package nl.dtls.adminpanel.database.migration.development.common; | ||
|
||
public interface Migration { | ||
|
||
void runMigration(); | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...in/java/nl/dtls/adminpanel/database/migration/development/instance/InstanceMigration.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package nl.dtls.adminpanel.database.migration.development.instance; | ||
|
||
import nl.dtls.adminpanel.database.migration.development.common.Migration; | ||
import nl.dtls.adminpanel.database.migration.development.instance.data.InstanceFixtures; | ||
import nl.dtls.adminpanel.database.repository.InstanceRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class InstanceMigration implements Migration { | ||
|
||
@Autowired | ||
private InstanceFixtures instanceFixtures; | ||
|
||
@Autowired | ||
private InstanceRepository instanceRepository; | ||
|
||
public void runMigration() { | ||
instanceRepository.deleteAll(); | ||
instanceRepository.save(instanceFixtures.fdpStaging()); | ||
} | ||
|
||
} |
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
25 changes: 25 additions & 0 deletions
25
src/main/java/nl/dtls/adminpanel/database/migration/development/server/ServerMigration.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package nl.dtls.adminpanel.database.migration.development.server; | ||
|
||
import nl.dtls.adminpanel.database.migration.development.common.Migration; | ||
import nl.dtls.adminpanel.database.migration.development.server.data.ServerFixtures; | ||
import nl.dtls.adminpanel.database.repository.ServerRepository; | ||
import nl.dtls.adminpanel.entity.Server; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class ServerMigration implements Migration { | ||
|
||
@Autowired | ||
private ServerFixtures serverFixtures; | ||
|
||
@Autowired | ||
private ServerRepository serverRepository; | ||
|
||
public void runMigration() { | ||
serverRepository.deleteAll(); | ||
Server fdpServer = serverFixtures.fdpServer(); | ||
serverRepository.save(fdpServer); | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...atabase/fixtures/data/ServerFixtures.java → ...velopment/server/data/ServerFixtures.java
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
24 changes: 24 additions & 0 deletions
24
src/main/java/nl/dtls/adminpanel/database/migration/development/user/UserMigration.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package nl.dtls.adminpanel.database.migration.development.user; | ||
|
||
import nl.dtls.adminpanel.database.migration.development.common.Migration; | ||
import nl.dtls.adminpanel.database.migration.development.user.data.UserFixtures; | ||
import nl.dtls.adminpanel.database.repository.UserRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class UserMigration implements Migration { | ||
|
||
@Autowired | ||
private UserRepository userRepository; | ||
|
||
@Autowired | ||
private UserFixtures userFixtures; | ||
|
||
public void runMigration() { | ||
userRepository.deleteAll(); | ||
userRepository.save(userFixtures.albert()); | ||
userRepository.save(userFixtures.nikola()); | ||
} | ||
|
||
} |
Oops, something went wrong.