feat: liqubase update

This commit is contained in:
Petr Rudichev 2025-02-19 19:00:25 +03:00
parent 10f6c7753d
commit 50d0d0440e
9 changed files with 111 additions and 4 deletions

View File

@ -2,10 +2,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
<changeSet id="2025-02-19--0005-terminals" author="Petr Rudichev">
<changeSet id="2025-02-19--0004-offices" author="Petr Rudichev">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="terminals"/>
<tableExists tableName="offices"/>
</not>
</preConditions>
@ -58,7 +58,7 @@
private List<Terminal> terminals;
-->
<createTable tableName="terminals">
<createTable tableName="offices">
<column name="id" type="BIGINT" autoIncrement="true">
<constraints primaryKey="true" nullable="false" unique="true"/>
</column>

View File

@ -16,7 +16,7 @@
<column name="name" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="code" type="BIGINT">
<column name="code" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="office_id" type="BIGINT">

View File

@ -0,0 +1,55 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
<changeSet id="2025-02-19--0006-employees" author="Petr Rudichev">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="employees"/>
</not>
</preConditions>
<createTable tableName="employees">
<column name="id" type="BIGINT" autoIncrement="true">
<constraints primaryKey="true" nullable="false" unique="true"/>
</column>
<column name="name" type="VARCHAR(100)">
<constraints nullable="false"/>
</column>
<column name="surname" type="VARCHAR(100)">
<constraints nullable="false"/>
</column>
<column name="patronymic" type="VARCHAR(100)"/>
<column name="about_me" type="VARCHAR(300)"/>
<column name="telephone" type="VARCHAR(20)">
<constraints nullable="false" unique="true"/>
</column>
<column name="email" type="VARCHAR(255)">
<constraints nullable="false" unique="true"/>
</column>
<column name="password" type="VARCHAR(300)">
<constraints nullable="false"/>
</column>
<column name="office_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_employees_office"
referencedTableName="offices"
referencedColumnNames="id"
deleteCascade="false" />
</column>
<column name="role_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_volunteer_roles"
referencedTableName="roles" referencedColumnNames="id" deleteCascade="false"/>
</column>
<column name="pos_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_employees_positions"
referencedTableName="roles" referencedColumnNames="id" deleteCascade="false"/>
</column>
<column name="profile_image_url" type="VARCHAR(100)"/>
<column name="is_blocked" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="created_at" type="DATETIME" valueDate="current_datetime" defaultValueDate="current_datetime"/>
</createTable>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,43 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
<changeSet id="2025-02-19--0007-visits" author="Petr Rudichev">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="visits"/>
</not>
</preConditions>
<createTable tableName="visits">
<column name="id" type="BIGINT" autoIncrement="true">
<constraints primaryKey="true" nullable="false" unique="true"/>
</column>
<column name="employee_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_visits_office"
referencedTableName="employees"
referencedColumnNames="id"
deleteCascade="false" />
</column>
<column name="start_visit" type="DATETIME" valueDate="current_datetime" defaultValueDate="current_datetime"/>
<column name="end_visit" type="DATETIME">
<constraints nullable="true"/>
</column>
<column name="is_finished" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="start_terminal_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_employees_start_terminals"
referencedTableName="terminals" referencedColumnNames="id" deleteCascade="false"/>
</column>
<column name="end_terminal_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_employees_end_terminals"
referencedTableName="terminals" referencedColumnNames="id" deleteCascade="false"/>
</column>
<column name="type_passage" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_employees_passages"
referencedTableName="passages" referencedColumnNames="id" deleteCascade="false"/>
</column>
</createTable>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,2 @@
name;description;address;latitude;longitude;logo_image_url;telephone;email
Офис в Москве;Любимый офис Владимира Путина;г. Москва;54.31207;48.393951;https://storage.yandexcloud.net/spring-boot-final-nto-bacet/standard/profile--1.jpg;+794145546556;limasov_krut@gmail.com
1 name description address latitude longitude logo_image_url telephone email
2 Офис в Москве Любимый офис Владимира Путина г. Москва 54.31207 48.393951 https://storage.yandexcloud.net/spring-boot-final-nto-bacet/standard/profile--1.jpg +794145546556 limasov_krut@gmail.com

View File

@ -0,0 +1,2 @@
name;code;office_id
Первый считыватель в Москве;313123323232312;1
1 name code office_id
2 Первый считыватель в Москве 313123323232312 1

View File

@ -0,0 +1,2 @@
name;surname;patronymic;about_me;telephone;email;password;office_id;pos_id;role_id;profile_image_url;created_at;is_blocked
Иван;Иванович;Иванов;Меня зовут Алексей, и я уже несколько лет занимаюсь волонтерской деятельностью.;+79263321231;example1@gmail.com;$2a$04$NybaY71VUlBaqzmyit2VBOFiJjuz0gO519e8WwVGK4eQkIUctLfgy;1;1;2;https://storage.yandexcloud.net/spring-boot-final-nto-bacet/standard/profile--10.jpg;now;false
1 name surname patronymic about_me telephone email password office_id pos_id role_id profile_image_url created_at is_blocked
2 Иван Иванович Иванов Меня зовут Алексей, и я уже несколько лет занимаюсь волонтерской деятельностью. +79263321231 example1@gmail.com $2a$04$NybaY71VUlBaqzmyit2VBOFiJjuz0gO519e8WwVGK4eQkIUctLfgy 1 1 2 https://storage.yandexcloud.net/spring-boot-final-nto-bacet/standard/profile--10.jpg now false

View File

@ -0,0 +1,3 @@
employee_id;start_visit;end_visit;is_finished;start_terminal_id;end_terminal_id;type_passage
1;now;now;true;1;1;2
1;now;null;false;1;1;1
1 employee_id start_visit end_visit is_finished start_terminal_id end_terminal_id type_passage
2 1 now now true 1 1 2
3 1 now null false 1 1 1