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 support for mariadb #16

Merged
merged 5 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/H

## [Building and running](#building-and-running)

### [The student-mobility-inteken-ontvanger-generiek-server](#student-mobility-inteken-ontvanger-generiek-server)
### [The student-mobility-inteken-ontvanger-generiek-server](#the-student-mobility-inteken-ontvanger-generiek-server)

This project uses Spring Boot and Maven. To run locally, type:

Expand Down
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
<version>42.6.1</version>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client -->
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.3.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,19 @@ spring:
dialect: org.hibernate.dialect.H2Dialect
open-in-view: false
datasource:
## Default filebased storage
driver-class-name: org.h2.Driver
url: jdbc:h2:file:./database/student-mobility
## For Postgress use :
# driver-class-name: org.postgresql.Driver
# url: jdbc:postgresql://localhost:5432/mobility
# username: mobility_rw
# password: secret
## For mariadb use :
# driver-class-name: org.mariadb.jdbc.Driver
# url: jdbc:mariadb://localhost:3306/mobility
# username: mobility_rw
# password: secret
flyway:
locations: classpath:db/{vendor}/migration

Expand Down
12 changes: 12 additions & 0 deletions src/main/resources/db/mariadb/migration/V0__initial.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE TABLE enrollment_requests
(
id BIGINT PRIMARY KEY,
identifier VARCHAR(254) NOT NULL,
person_uri VARCHAR(255) NOT NULL,
results_uri VARCHAR(255) NOT NULL,
person_id VARCHAR(255),
access_token TEXT,
refresh_token TEXT,
scope TEXT NOT NULL,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE enrollment_requests RENAME COLUMN person_id TO eduid;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE enrollment_requests ADD COLUMN person_auth VARCHAR(255);
UPDATE enrollment_requests set person_auth = 'HEADER';
ALTER TABLE enrollment_requests MODIFY person_auth VARCHAR(255) NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE enrollment_requests ADD COLUMN home_institution VARCHAR(255);
ALTER TABLE enrollment_requests DROP COLUMN results_uri;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE associations
(
id BIGINT PRIMARY KEY,
association_id VARCHAR(254) NOT NULL,
enrollment_request_id BIGINT NOT NULL,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_enrollment_request_id FOREIGN KEY (enrollment_request_id) REFERENCES enrollment_requests(id) ON DELETE CASCADE
);
3 changes: 3 additions & 0 deletions src/main/resources/db/mariadb/migration/V5__indexes.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE INDEX association_id_index ON associations(association_id);
CREATE INDEX eduid_index ON enrollment_requests(eduid);
CREATE INDEX identifier_index ON enrollment_requests(identifier);
Loading