Skip to content

Commit

Permalink
db.changeloges
Browse files Browse the repository at this point in the history
  • Loading branch information
Optic-Okulist committed Sep 11, 2023
1 parent 481e6a2 commit 43fce26
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/main/resources/db/changelog/changes/03-create-users-table.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
databaseChangeLog:
- changeSet:
id: create-users-table
author: Ros
changes:
- createTable:
tableName: users
columns:
- column:
name: id
type: bigint
autoIncrement: true
constraints:
primaryKey: true
nullable: false
- column:
name: email
type: varchar(255)
constraints:
nullable: false
unique: true
- column:
name: password
type: varchar(255)
constraints:
nullable: false
- column:
name: first_name
type: varchar(255)
constraints:
nullable: false
- column:
name: last_name
type: varchar(255)
constraints:
nullable: false
- column:
name: shipping_address
type: varchar(255)
- column:
name: is_deleted
type: boolean
constraints:
nullable: false
defaultValue: "false"
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
databaseChangeLog:
- changeSet:
id: fill-users-table-by-data
author: Ros
changes:
- insert:
tableName: users
columns:
- column: {name: "email", value: "[email protected]"}
- column: {name: "password", value: "$%^&*()DFGHJKL>dfghjkl$%^&*()DFGHJKL>dfghjkl"} # "111"}
- column: {name: "first_name", value: "John"}
- column: {name: "last_name", value: "alicovich"}
- column: {name: "shipping_address", value: "provulok bobd, cpo55"}
- insert:
tableName: users
columns:
- column: {name: "email", value: "[email protected]"}
- column: {name: "password", value: "DFGHJKL:#$%^&*()34567890SDFGHJKLdfghjk0SDFGHJKLdfghjk"} # "222"}
- column: {name: "first_name", value: "alice"}
- column: {name: "last_name", value: "bobovich"}
- column: {name: "shipping_address", value: "provulok alice, jkE33"}
- insert:
tableName: users
columns:
- column: {name: "email", value: "[email protected]"}
- column: {name: "password", value: "lkjftFHHJJNBVDD$%^*IHBHGCGF3"} # "333"}
- column: {name: "first_name", value: "bob"}
- column: {name: "last_name", value: "alison"}
- column: {name: "shipping_address", value: "provulok boba, sH12"}
27 changes: 27 additions & 0 deletions src/main/resources/db/changelog/changes/05-create-roles-table.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
databaseChangeLog:
- changeSet:
id: create-roles-table
author: Ros
changes:
- createTable:
tableName: roles
columns:
- column:
name: id
type: bigint
autoIncrement: true
constraints:
primaryKey: true
nullable: false
- column:
name: name
type: varchar(255)
constraints:
nullable: false
unique: true
- column:
name: is_deleted
type: boolean
constraints:
nullable: false
defaultValue: "false"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
databaseChangeLog:
- changeSet:
id: fill-roles-table-by-data
author: Ros
changes:
- insert:
tableName: roles
columns:
- column: {name: "name", value: "ADMIN"}
- insert:
tableName: roles
columns:
- column: {name: "name", value: "USER"}

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
databaseChangeLog:
- changeSet:
id: create-users-roles-table
author: Ros
changes:
- createTable:
tableName: users_roles
columns:
- column:
name: user_id
type: bigint
constraints:
foreignKeyName: fk_users_roles_users
referencedTableName: users
referencedColumnNames: id
nullable: false
primaryKey: true
- column:
name: role_id
type: bigint
constraints:
foreignKeyName: fk_users_roles_roles
referencedTableName: roles
referencedColumnNames: id
nullable: false
primaryKey: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
databaseChangeLog:
- changeSet:
id: fill-users-roles-table-by-data
author: Ros
changes:
- insert:
tableName: users_roles
columns:
- column: {name: "user_id", value: "1"}
- column: {name: "role_id", value: "1"}
- insert:
tableName: users_roles
columns:
- column: {name: "user_id", value: "2"}
- column: {name: "role_id", value: "2"}
- insert:
tableName: users_roles
columns:
- column: {name: "user_id", value: "3"}
- column: {name: "role_id", value: "2"}
15 changes: 15 additions & 0 deletions src/main/resources/db/changelog/db.changelog-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ databaseChangeLog:
file: db/changelog/changes/01-create-books-table.yaml
- include:
file: db/changelog/changes/02-fill-books-table-with-data.yaml
- include:
file: db/changelog/changes/03-create-users-table.yaml
- include:
file: db/changelog/changes/04-fill-users-table-with-data.yaml
- include:
file: db/changelog/changes/05-create-roles-table.yaml
- include:
file: db/changelog/changes/06-fill-roles-table-by-data.yaml
- include:
file: db/changelog/changes/07-create-users-roles-table.yaml
- include:
file: db/changelog/changes/08-fill-users-roles-table-with-data.yaml






Expand Down

0 comments on commit 43fce26

Please sign in to comment.