Skip to content

Commit

Permalink
VKT(Backend): DB changelog and init_sql cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jrkkp committed Nov 13, 2024
1 parent d5827b4 commit 85eca97
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 118 deletions.
5 changes: 4 additions & 1 deletion backend/vkt/db/1_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ CREATE TABLE public.enrollment_appointment (
grade_id bigint,
examiner_exam_event_id bigint,
previous_enrollment text,
message text
message text,
payment_link_hash text,
auth_hash_expires date,
auth_hash_sent date
);


Expand Down
8 changes: 2 additions & 6 deletions backend/vkt/db/3_liquibase.sql
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,13 @@ COPY public.databasechangelog (id, author, filename, dateexecuted, orderexecuted
2024-08-14-add-is-queued-to-enrollment jrkkp migrations.xml 2024-11-06 13:14:31.832944 30 EXECUTED 9:0c6f186a9f15e2e395cd24d1652bd239 addColumn tableName=enrollment; sql; sql \N 4.29.1 \N \N 0891671690
2024-08-27-all-koski-educations pkoivisto migrations.xml 2024-11-06 13:14:31.845359 31 EXECUTED 9:aee4a31a7eb021b38755e24b0c30070f createTable tableName=koski_educations; addForeignKeyConstraint baseTableName=koski_educations, constraintName=fk_koski_educations_free_enrollment, referencedTableName=free_enrollment; addForeignKeyConstraint baseTableName=koski_educations, constr... \N 4.29.1 \N \N 0891671690
2024-09-11-registration-open-and-close-times-psql jrkkp migrations.xml 2024-11-06 13:14:31.862263 32 EXECUTED 9:27e10d6992e13a438d8945de985d1fa7 sql \N 4.29.1 \N \N 0891671690
2024-09-16-enrollment_appointment jrkkp migrations.xml 2024-11-06 13:14:31.874047 33 EXECUTED 9:2ac5933bca860e5cbbd3f9592c718275 createTable tableName=enrollment_appointment; addColumn tableName=payment \N 4.29.1 \N \N 0891671690
2024-10-04-examiner-and-municipality-tables pkoivisto migrations.xml 2024-11-06 13:14:31.897791 34 EXECUTED 9:17684f1fcc2b8eeda7ed7db0865b421a createTable tableName=examiner; createTable tableName=municipality; createTable tableName=examiner_municipality; addUniqueConstraint constraintName=uk_examiner_municipality_examiner_id_municipality_id, tableName=examiner_municipality; addForeignKe... \N 4.29.1 \N \N 0891671690
2024-10-15-exam_event-add-reference-to-examiner pkoivisto migrations.xml 2024-11-06 13:14:31.905791 35 EXECUTED 9:88276462edd4a15ef2f384cd6094990c dropUniqueConstraint constraintName=uk_exam_event_language_level_date, tableName=exam_event; addColumn tableName=exam_event; addForeignKeyConstraint baseTableName=exam_event, constraintName=fk_exam_event_examiner_id, referencedTableName=examiner \N 4.29.1 \N \N 0891671690
2024-10-15-exam_level-new-value pkoivisto migrations.xml 2024-11-06 13:14:31.909788 36 EXECUTED 9:8faf60b4438613d90a29a860678bf66e insert tableName=exam_level \N 4.29.1 \N \N 0891671690
2024-10-15-unique-exam-event-language-level-date-examiner-on-psql pkoivisto migrations.xml 2024-11-06 13:14:31.915393 37 EXECUTED 9:b69bb176a254f507ddeb877153d6b162 sql \N 4.29.1 \N \N 0891671690
2024-11-04-add-enrollment_appointment-missing-fields jrkkp migrations.xml 2024-11-06 13:14:31.922772 38 EXECUTED 9:b982dffea40ebba3a547a1afd7a3ca6a addColumn tableName=enrollment_appointment \N 4.29.1 \N \N 0891671690
2024-11-07-add-enrollment_appointment-missing-fields-2 jrkkp migrations.xml 2024-11-07 13:17:52.164316 39 EXECUTED 9:a5aa107cb7c4dce06ff0e2bff24ed2f8 addColumn tableName=enrollment_appointment; addForeignKeyConstraint baseTableName=enrollment_appointment, constraintName=fk_enrollment_appointment_examiner_id, referencedTableName=examiner \N 4.29.1 \N \N 0978272132
2024-11-07-new-examiner_exam_event-table pkoivisto migrations.xml 2024-11-07 23:04:47.179822 40 EXECUTED 9:cf0bb0d78f0f4adddd3d7147692d1eed createTable tableName=examiner_exam_event; addForeignKeyConstraint baseTableName=examiner_exam_event, constraintName=fk_examiner_exam_event_examiner_id, referencedTableName=examiner; addForeignKeyConstraint baseTableName=examiner_exam_event, const... \N 4.29.1 \N \N 1013487153
2024-11-11-grade-table jrkkp migrations.xml 2024-11-10 23:08:41.052724 41 EXECUTED 9:43366e2913881add0d3225014f755c64 createTable tableName=enrollment_grade; addColumn tableName=enrollment_appointment; addForeignKeyConstraint baseTableName=enrollment_appointment, constraintName=fk_enrollment_appointment_grade_id, referencedTableName=enrollment_grade \N 4.29.1 \N \N 1272921016
2024-11-08-add-enrollment-appointment-missing-fields-3 pkoivisto migrations.xml 2024-11-11 11:38:45.813381 42 EXECUTED 9:c8743f2a64a80316026c89ba43ef3c1c addColumn tableName=enrollment_appointment; addForeignKeyConstraint baseTableName=enrollment_appointment, constraintName=fk_enrollment_appointment_examiner_exam_event_id, referencedTableName=examiner_exam_event \N 4.29.1 \N \N 1317925790
2024-11-12-add-enrollment_appointment-missing-fields-4 jrkkp migrations.xml 2024-11-12 15:46:50.287328 43 EXECUTED 9:1de91200b162138cede8440b9606fe83 addColumn tableName=enrollment_appointment \N 4.29.1 \N \N 1419210268
2024-11-11-grade-table jrkkp migrations.xml 2024-11-10 23:08:41.052724 41 EXECUTED 9:cb045c4425bef824bbdb452db81ec27c createTable tableName=enrollment_grade; addColumn tableName=enrollment_appointment; addForeignKeyConstraint baseTableName=enrollment_appointment, constraintName=fk_enrollment_appointment_grade_id, referencedTableName=enrollment_grade \N 4.29.1 \N \N 1272921016
2024-11-13-enrollment_appointment jrkkp migrations.xml 2024-11-13 11:14:31.874047 33 EXECUTED 9:295984d9a5dcec07dae20e4837681165 createTable tableName=enrollment_appointment; addColumn tableName=payment \N 4.29.1 \N \N 0891671690
\.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,16 +691,4 @@ public void createEnrollmentContact(final PublicEnrollmentContactCreateDTO dto,

enrollmentAppointmentRepository.saveAndFlush(enrollmentAppointment);
}

public PublicExaminerDTO getExaminer(final long examinerId) {
return PublicExaminerDTO
.builder()
.id(examinerId)
.examDates(List.of(PublicExaminerExamDateDTO.builder().examDate(LocalDate.now()).isFull(false).build()))
.languages(List.of())
.municipalities(List.of())
.firstName("Testi")
.lastName("Testilä")
.build();
}
}
178 changes: 79 additions & 99 deletions backend/vkt/src/main/resources/db/changelog/db.changelog-1.0.xml
Original file line number Diff line number Diff line change
Expand Up @@ -859,65 +859,6 @@
ALTER TABLE exam_event ADD COLUMN registration_opens TIMESTAMP WITH TIME ZONE;
</sql>
</changeSet>
<changeSet id="2024-09-16-enrollment_appointment" author="jrkkp">
<createTable tableName="enrollment_appointment">
<column autoIncrement="true" name="enrollment_appointment_id" type="BIGSERIAL">
<constraints primaryKey="true" primaryKeyName="enrollment_appointment_pkey" />
</column>
<column name="version" type="INT" defaultValueNumeric="0">
<constraints nullable="false"/>
</column>
<column name="created_by" type="TEXT"/>
<column name="modified_by" type="TEXT"/>
<column name="deleted_by" type="TEXT"/>
<column name="created_at" type="TIMESTAMP WITH TIME ZONE" defaultValueComputed="CURRENT_TIMESTAMP">
<constraints nullable="false"/>
</column>
<column name="modified_at" type="TIMESTAMP WITH TIME ZONE" defaultValueComputed="CURRENT_TIMESTAMP">
<constraints nullable="false"/>
</column>
<column name="deleted_at" type="TIMESTAMP WITH TIME ZONE"/>
<column name="skill_oral" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="skill_textual" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="skill_understanding" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="partial_exam_speaking" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="partial_exam_speech_comprehension" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="partial_exam_writing" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="partial_exam_reading_comprehension" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="status" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="previous_enrollment_date" type="DATE"/>
<column name="digital_certificate_consent" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="auth_hash" type="TEXT" />
<column name="email" type="TEXT" />
<column name="phone_number" type="TEXT" />
<column name="street" type="TEXT"/>
<column name="postal_code" type="TEXT"/>
<column name="town" type="TEXT"/>
<column name="country" type="TEXT"/>
<column name="person_id" type="BIGINT" />
</createTable>
<addColumn tableName="payment">
<column name="enrollment_appointment_id" type="BIGINT" />
</addColumn>
</changeSet>
<changeSet id="2024-10-04-examiner-and-municipality-tables" author="pkoivisto">
<createTable tableName="examiner">
<column autoIncrement="true" name="examiner_id" type="BIGSERIAL">
Expand Down Expand Up @@ -1020,28 +961,6 @@
referencedTableName="municipality"
referencedColumnNames="municipality_id"/>
</changeSet>
<changeSet id="2024-10-15-exam_level-new-value" author="pkoivisto">
<insert tableName="exam_level">
<column name="name" value="GOOD_AND_SATISFACTORY"/>
</insert>
</changeSet>
<changeSet id="2024-11-04-add-enrollment_appointment-missing-fields" author="jrkkp">
<addColumn tableName="enrollment_appointment">
<column name="first_name" type="TEXT" />
<column name="last_name" type="TEXT" />
</addColumn>
</changeSet>
<changeSet id="2024-11-07-add-enrollment_appointment-missing-fields-2" author="jrkkp">
<addColumn tableName="enrollment_appointment">
<column name="examiner_id" type="BIGINT" />
</addColumn>
<addForeignKeyConstraint
baseTableName="enrollment_appointment"
baseColumnNames="examiner_id"
constraintName="fk_enrollment_appointment_examiner_id"
referencedTableName="examiner"
referencedColumnNames="examiner_id"/>
</changeSet>
<changeSet id="2024-11-07-new-examiner_exam_event-table" author="pkoivisto">
<createTable tableName="examiner_exam_event">
<column autoIncrement="true" name="examiner_exam_event_id" type="BIGSERIAL">
Expand Down Expand Up @@ -1100,17 +1019,6 @@
constraintName="fk_examiner_exam_event_language"
onDelete="NO ACTION" onUpdate="NO ACTION"/>
</changeSet>
<changeSet id="2024-11-08-add-enrollment-appointment-missing-fields-3" author="pkoivisto">
<addColumn tableName="enrollment_appointment">
<column name="examiner_exam_event_id" type="BIGINT" />
</addColumn>
<addForeignKeyConstraint
baseTableName="enrollment_appointment"
baseColumnNames="examiner_exam_event_id"
constraintName="fk_enrollment_appointment_examiner_exam_event_id"
referencedTableName="examiner_exam_event"
referencedColumnNames="examiner_exam_event_id"/>
</changeSet>
<changeSet id="2024-11-11-grade-table" author="jrkkp">
<createTable tableName="enrollment_grade">
<column autoIncrement="true" name="grade_id" type="BIGSERIAL">
Expand Down Expand Up @@ -1138,20 +1046,92 @@
<column name="writing_comment" type="TEXT" />
<column name="comprehension_comment" type="TEXT" />
</createTable>
<addColumn tableName="enrollment_appointment">
</changeSet>
<changeSet id="2024-11-13-enrollment_appointment" author="jrkkp">
<createTable tableName="enrollment_appointment">
<column autoIncrement="true" name="enrollment_appointment_id" type="BIGSERIAL">
<constraints primaryKey="true" primaryKeyName="enrollment_appointment_pkey" />
</column>
<column name="version" type="INT" defaultValueNumeric="0">
<constraints nullable="false"/>
</column>
<column name="created_by" type="TEXT"/>
<column name="modified_by" type="TEXT"/>
<column name="deleted_by" type="TEXT"/>
<column name="created_at" type="TIMESTAMP WITH TIME ZONE" defaultValueComputed="CURRENT_TIMESTAMP">
<constraints nullable="false"/>
</column>
<column name="modified_at" type="TIMESTAMP WITH TIME ZONE" defaultValueComputed="CURRENT_TIMESTAMP">
<constraints nullable="false"/>
</column>
<column name="deleted_at" type="TIMESTAMP WITH TIME ZONE"/>
<column name="skill_oral" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="skill_textual" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="skill_understanding" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="partial_exam_speaking" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="partial_exam_speech_comprehension" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="partial_exam_writing" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="partial_exam_reading_comprehension" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="status" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="previous_enrollment_date" type="DATE"/>
<column name="digital_certificate_consent" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="auth_hash" type="TEXT" />
<column name="email" type="TEXT" />
<column name="phone_number" type="TEXT" />
<column name="first_name" type="TEXT" />
<column name="last_name" type="TEXT" />
<column name="street" type="TEXT"/>
<column name="postal_code" type="TEXT"/>
<column name="town" type="TEXT"/>
<column name="country" type="TEXT"/>
<column name="person_id" type="BIGINT" />
<column name="payment_link_hash" type="TEXT" />
<column name="auth_hash_expires" type="DATE" />
<column name="auth_hash_sent" type="DATE" />
<column name="previous_enrollment" type="TEXT" />
<column name="message" type="TEXT" />
<column name="grade_id" type="BIGINT" />
</addColumn>
<column name="examiner_id" type="BIGINT" />
<column name="examiner_exam_event_id" type="BIGINT" />
</createTable>
<addForeignKeyConstraint
baseTableName="enrollment_appointment"
baseColumnNames="grade_id"
constraintName="fk_enrollment_appointment_grade_id"
referencedTableName="enrollment_grade"
referencedColumnNames="grade_id"/>
</changeSet>
<changeSet id="2024-11-12-add-enrollment_appointment-missing-fields-4" author="jrkkp">
<addColumn tableName="enrollment_appointment">
<column name="previous_enrollment" type="TEXT" />
<column name="message" type="TEXT" />
<addForeignKeyConstraint
baseTableName="enrollment_appointment"
baseColumnNames="examiner_id"
constraintName="fk_enrollment_appointment_examiner_id"
referencedTableName="examiner"
referencedColumnNames="examiner_id"/>
<addForeignKeyConstraint
baseTableName="enrollment_appointment"
baseColumnNames="examiner_exam_event_id"
constraintName="fk_enrollment_appointment_examiner_exam_event_id"
referencedTableName="examiner_exam_event"
referencedColumnNames="examiner_exam_event_id"/>
<addColumn tableName="payment">
<column name="enrollment_appointment_id" type="BIGINT" />
</addColumn>
</changeSet>
</databaseChangeLog>

0 comments on commit 85eca97

Please sign in to comment.