Add booking travel cities and member relation
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s
This commit is contained in:
@@ -23,5 +23,47 @@ class BookingSchemaFix(
|
||||
logger.info("Adding booking.expected_guest_count column")
|
||||
jdbcTemplate.execute("alter table booking add column expected_guest_count integer")
|
||||
}
|
||||
|
||||
val hasFromCity = jdbcTemplate.queryForObject(
|
||||
"""
|
||||
select count(*)
|
||||
from information_schema.columns
|
||||
where table_name = 'booking'
|
||||
and column_name = 'from_city'
|
||||
""".trimIndent(),
|
||||
Int::class.java
|
||||
) ?: 0
|
||||
if (hasFromCity == 0) {
|
||||
logger.info("Adding booking.from_city column")
|
||||
jdbcTemplate.execute("alter table booking add column from_city varchar")
|
||||
}
|
||||
|
||||
val hasToCity = jdbcTemplate.queryForObject(
|
||||
"""
|
||||
select count(*)
|
||||
from information_schema.columns
|
||||
where table_name = 'booking'
|
||||
and column_name = 'to_city'
|
||||
""".trimIndent(),
|
||||
Int::class.java
|
||||
) ?: 0
|
||||
if (hasToCity == 0) {
|
||||
logger.info("Adding booking.to_city column")
|
||||
jdbcTemplate.execute("alter table booking add column to_city varchar")
|
||||
}
|
||||
|
||||
val hasMemberRelation = jdbcTemplate.queryForObject(
|
||||
"""
|
||||
select count(*)
|
||||
from information_schema.columns
|
||||
where table_name = 'booking'
|
||||
and column_name = 'member_relation'
|
||||
""".trimIndent(),
|
||||
Int::class.java
|
||||
) ?: 0
|
||||
if (hasMemberRelation == 0) {
|
||||
logger.info("Adding booking.member_relation column")
|
||||
jdbcTemplate.execute("alter table booking add column member_relation varchar")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user