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

Added changesets #286

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
23 changes: 23 additions & 0 deletions src/main/resources/db/changelog/changes/create-actors-table.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
databaseChangeLog:
- changeSet:
id: create-actors-table
author: artem
changes:
- createTable:
tableName: actors
columns:
- column:
name: id
type: bigint
autoIncrement: true
constraints:
primaryKey: true
nullable: false
- column:
name: name
type: varchar(255)
constraints:
nullable: false
- column:
name: country_id
type: bigint
20 changes: 20 additions & 0 deletions src/main/resources/db/changelog/changes/create-countries-table.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
databaseChangeLog:
- changeSet:
id: create-countries-table
author: artem
changes:
- createTable:
tableName: countries
columns:
- column:
name: id
type: bigint
autoIncrement: true
constraints:
primaryKey: true
nullable: false
- column:
name: name
type: varchar(255)
constraints:
nullable: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
databaseChangeLog:
- changeSet:
id: create-movies-actors-table
author: artem
changes:
- createTable:
tableName: movies_actors
columns:
- column:
name: movie_id
type: bigint
constraints:
nullable: false
- column:
name: actor_id
type: bigint
constraints:
nullable: false
- addForeignKeyConstraint:
baseTableName: movies_actors
baseColumnNames: movie_id
constraintName: fk_movies_actors_movies
referencedTableName: movies
referencedColumnNames: id
- addForeignKeyConstraint:
baseTableName: movies_actors
baseColumnNames: actor_id
constraintName: fk_movies_actors_actors
referencedTableName: actors
referencedColumnNames: id
20 changes: 20 additions & 0 deletions src/main/resources/db/changelog/changes/create-movies-table.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
databaseChangeLog:
- changeSet:
id: create-movies-table
author: artem
changes:
- createTable:
tableName: movies
columns:
- column:
name: id
type: bigint
autoIncrement: true
constraints:
primaryKey: true
nullable: false
- column:
name: title
type: varchar(255)
constraints:
nullable: false
9 changes: 9 additions & 0 deletions src/main/resources/db/changelog/db.changelog-master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
databaseChangeLog:
- include:
file: /db/changelog/changes/create-countries-table.yml
- include:
file: /db/changelog/changes/create-actors-table.yml
- include:
file: /db/changelog/changes/create-movies-table.yml
- include:
file: /db/changelog/changes/create-movies-actors-table.yml
Empty file added src/main/resources/db/text.txt
Empty file.
6 changes: 3 additions & 3 deletions src/main/resources/hibernate.cfg.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.url">CHANGE_IT</property>
<property name="connection.url">jdbc:mysql://localhost:3306/test1?serverTimeZone=UTC</property>
<property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property>
<property name="connection.username">CHANGE_IT</property>
<property name="connection.password">CHANGE_IT</property>
<property name="connection.username">artem</property>
<property name="connection.password">Pssmgk_82</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">validate</property>
<mapping class="mate.academy.liquibase.model.Actor"/>
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/liquibase.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
url=jdbc:mysql://localhost:3306/CHANGE_IT
username=CHANGE_IT
password=CHANGE_IT
url=jdbc:mysql://localhost:3306/test1?serverTimeZone=UTC
username=artem
password=Pssmgk_82
changeLogFile=/db/changelog/db.changelog-master.yaml
Loading