feat: added liqubase scripts
This commit is contained in:
parent
4b721518e0
commit
fa674406f4
@ -0,0 +1,21 @@
|
|||||||
|
<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--0001-roles" author="Petr Rudichev">
|
||||||
|
<preConditions onFail="MARK_RAN">
|
||||||
|
<not>
|
||||||
|
<tableExists tableName="roles"/>
|
||||||
|
</not>
|
||||||
|
</preConditions>
|
||||||
|
|
||||||
|
<createTable tableName="roles">
|
||||||
|
<column name="id" type="BIGINT" autoIncrement="true">
|
||||||
|
<constraints primaryKey="true" nullable="false" unique="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="role_name" type="VARCHAR(100)">
|
||||||
|
<constraints nullable="false" unique="true"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
@ -0,0 +1,21 @@
|
|||||||
|
<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--0002-positions" author="Petr Rudichev">
|
||||||
|
<preConditions onFail="MARK_RAN">
|
||||||
|
<not>
|
||||||
|
<tableExists tableName="positions"/>
|
||||||
|
</not>
|
||||||
|
</preConditions>
|
||||||
|
|
||||||
|
<createTable tableName="positions">
|
||||||
|
<column name="id" type="BIGINT" autoIncrement="true">
|
||||||
|
<constraints primaryKey="true" nullable="false" unique="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="name" type="VARCHAR(255)">
|
||||||
|
<constraints nullable="false" unique="true"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
@ -0,0 +1,21 @@
|
|||||||
|
<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--0003-passages" author="Petr Rudichev">
|
||||||
|
<preConditions onFail="MARK_RAN">
|
||||||
|
<not>
|
||||||
|
<tableExists tableName="passages"/>
|
||||||
|
</not>
|
||||||
|
</preConditions>
|
||||||
|
|
||||||
|
<createTable tableName="passages">
|
||||||
|
<column name="id" type="BIGINT" autoIncrement="true">
|
||||||
|
<constraints primaryKey="true" nullable="false" unique="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="passage" type="VARCHAR(255)">
|
||||||
|
<constraints nullable="false" unique="true"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
@ -0,0 +1,89 @@
|
|||||||
|
<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--0005-terminals" author="Petr Rudichev">
|
||||||
|
<preConditions onFail="MARK_RAN">
|
||||||
|
<not>
|
||||||
|
<tableExists tableName="terminals"/>
|
||||||
|
</not>
|
||||||
|
</preConditions>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
@Column(name = "name", unique = true)
|
||||||
|
@NotBlank(message = "Название не может быть пустым!")
|
||||||
|
@Size(max = 100, message = "Максимальная длина названия 100 символов!")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(name = "description")
|
||||||
|
@NotBlank(message = "Описание не может быть пустым!")
|
||||||
|
@Size(max = 300, message = "Максимальная длина описания 300 символов!")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Column(name = "address")
|
||||||
|
@NotBlank(message = "Адрес не может быть пустым!")
|
||||||
|
@Size(max = 200, message = "Максимальный размер адреса 200 символов!")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@Column(name = "latitude")
|
||||||
|
@NotNull(message = "Широта не может быть пустой!")
|
||||||
|
private Double latitude;
|
||||||
|
|
||||||
|
@Column(name = "longitude")
|
||||||
|
@NotNull(message = "Долгота не может быть пустой!")
|
||||||
|
private Double longitude;
|
||||||
|
|
||||||
|
@Column(name = "logo_image_url")
|
||||||
|
@NotBlank(message = "Путь к логотипу не может быть пустой!")
|
||||||
|
@Size(max = 200, message = "Максимальный размер пути к логотипу 200 символов!")
|
||||||
|
private String linkLogo;
|
||||||
|
|
||||||
|
@Column(name = "telephone")
|
||||||
|
@Size(max = 20, message = "Максимальная длина телефонного номера 20 символов!")
|
||||||
|
private String telephone;
|
||||||
|
|
||||||
|
@Column(name = "email")
|
||||||
|
@Size(max = 255, message = "Максимальная длина email 255 символов")
|
||||||
|
@Email(message = "Email адрес должен быть в формате user@example.com!")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "office")
|
||||||
|
private List<Employee> employeeList;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "office")
|
||||||
|
private List<Terminal> terminals;
|
||||||
|
-->
|
||||||
|
|
||||||
|
<createTable tableName="terminals">
|
||||||
|
<column name="id" type="BIGINT" autoIncrement="true">
|
||||||
|
<constraints primaryKey="true" nullable="false" unique="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="name" type="VARCHAR(255)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="description" type="VARCHAR(255)"/>
|
||||||
|
<column name="address" type="VARCHAR(200)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="latitude" type="DOUBLE PRECISION">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="longitude" type="DOUBLE PRECISION">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="logo_image_url" type="VARCHAR(255)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="telephone" type="VARCHAR(20)">
|
||||||
|
<constraints nullable="false" unique="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="email" type="VARCHAR(255)">
|
||||||
|
<constraints nullable="false" unique="true"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
@ -0,0 +1,34 @@
|
|||||||
|
<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--0005-terminals" author="Petr Rudichev">
|
||||||
|
<preConditions onFail="MARK_RAN">
|
||||||
|
<not>
|
||||||
|
<tableExists tableName="terminals"/>
|
||||||
|
</not>
|
||||||
|
</preConditions>
|
||||||
|
|
||||||
|
<createTable tableName="terminals">
|
||||||
|
<column name="id" type="BIGINT" autoIncrement="true">
|
||||||
|
<constraints primaryKey="true" nullable="false" unique="true"/>
|
||||||
|
</column>
|
||||||
|
<column name="name" type="VARCHAR(255)">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="code" type="BIGINT">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="office_id" type="BIGINT">
|
||||||
|
<constraints nullable="false" foreignKeyName="fk_terminals_office"
|
||||||
|
referencedTableName="offices"
|
||||||
|
referencedColumnNames="id"
|
||||||
|
deleteCascade="false" />
|
||||||
|
</column>
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
|
||||||
|
@JoinColumn(name = "office_id", nullable = false)
|
||||||
|
private Office office;
|
||||||
|
</createTable>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
@ -0,0 +1,9 @@
|
|||||||
|
<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--0001-roles-data" author="Petr Rudichev">
|
||||||
|
<loadData tableName="roles" file="db.changelog/data/csv/2025-02-19--0001-roles-data.csv"
|
||||||
|
separator=";" quotchar="*" encoding="UTF-8"/>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
@ -0,0 +1,9 @@
|
|||||||
|
<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--0002-positions-data" author="Petr Rudichev">
|
||||||
|
<loadData tableName="positions" file="db.changelog/data/csv/2025-02-19--0002-positions-data.csv"
|
||||||
|
separator=";" quotchar="*" encoding="UTF-8"/>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
@ -0,0 +1,9 @@
|
|||||||
|
<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--0003-passages-data" author="Petr Rudichev">
|
||||||
|
<loadData tableName="passages" file="db.changelog/data/csv/2025-02-19--0003-passages-data.csv"
|
||||||
|
separator=";" quotchar="*" encoding="UTF-8"/>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
@ -0,0 +1,3 @@
|
|||||||
|
role_name
|
||||||
|
ROLE_USER
|
||||||
|
ROLE_ADMIN
|
|
@ -0,0 +1,4 @@
|
|||||||
|
name
|
||||||
|
Директор
|
||||||
|
Разработчик
|
||||||
|
Дизайнер
|
|
@ -0,0 +1,3 @@
|
|||||||
|
passage
|
||||||
|
Карта
|
||||||
|
Телефон
|
|
@ -1,4 +1,9 @@
|
|||||||
<databaseChangeLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<databaseChangeLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
|
||||||
|
|
||||||
|
<include file="db.changelog/0.0.1/2025-02-19--0001-roles.xml" />
|
||||||
|
<include file="db.changelog/0.0.1/2025-02-19--0002-positions.xml" />
|
||||||
|
<include file="db.changelog/0.0.1/2025-02-19--0002-positions.xml" />
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
Loading…
x
Reference in New Issue
Block a user