liquibase example some changes

This commit is contained in:
stvort committed 2020-05-27 00:03:33 +04:00
1 parent 591be74752
commit 5e6eb5bfd9
7 files changed
+13 -10

No files matched your search

@@ -3,6 +3,9 @@ package ru.otus.spring;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
// url h2 консоли: http://localhost:8080/h2-console
// url базы: jdbc:h2:mem:testdb
@SpringBootApplication
public class Main {
@@ -1,11 +1,11 @@
--liquibase formatted sql
--changeset stvort:2020-05-25-002-avatars
--changeset stvort:2020-05-25-001-avatars
create table avatars (
id bigserial,
photo_url varchar(255)
)
--changeset stvort:2020-05-25-002-users-avatars-id
--changeset stvort:2020-05-25-001-users-avatars-id
alter table users
add column avatar_id bigint references avatars(id) ON DELETE SET NULL
@@ -2,7 +2,7 @@
"databaseChangeLog": [
{
"changeSet": {
"id": "2020-05-25--003-emails",
"id": "2020-05-25--002-emails",
"author": "stvort",
"changes": [
{
@@ -16,8 +16,7 @@
"autoIncrement": true,
"constraints": {
"primaryKey": true,
"nullable": false,
"deleteCascade": true
"nullable": false
}
}
},
@@ -28,7 +27,8 @@
"constraints": {
"nullable": false,
"foreignKeyName": "fk_emails_users",
"references": "users(id)"
"references": "users(id)",
"deleteCascade": true
}
}
},
@@ -5,7 +5,7 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet id="2020-05-25--001-courses" author="stvort">
<changeSet id="2020-05-25--003-courses" author="stvort">
<createTable tableName="courses">
<column name="id" type="bigint" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
@@ -14,7 +14,7 @@
</createTable>
</changeSet>
<changeSet id="2020-05-25--001-users_courses" author="stvort">
<changeSet id="2020-05-25--003-users_courses" author="stvort">
<createTable tableName="users_courses">
<column name="user_id" type="bigint">
<constraints nullable="false"
@@ -21,7 +21,7 @@ databaseChangeLog:
runOnChange: true
loadUpdateData:
primaryKey: id
file: data/2020-05-25--0002-users.csv
file: data/2020-05-25--0002-users-avatars.csv
relativeToChangelogFile: true
separator: ;
quotChar: '"'
@@ -10,5 +10,5 @@ values (1, 'Разработчик Java'),
--changeset stvort:2020-05-25-002-users-courses
insert into users_courses (user_id, course_id)
values (1, 1), (1, 2), (1, 3), (1, 4),
(2, 1), (2, 2), (1, 3),
(2, 1), (2, 2), (2, 3),
(3, 3), (3, 4)
File renamed without changes.
Internal Server Error - Gitea: Git with a cup of tea
500 Internal Server Error

An error occurred:

An error occurred

Gitea Version: 28.2.0