Add expected guest count on booking
Some checks failed
build-and-deploy / build-deploy (push) Failing after 27s

This commit is contained in:
androidlover5842
2026-01-29 09:34:32 +05:30
parent 5214584b3c
commit f342b229f4
4 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
package com.android.trisolarisserver.config
import org.springframework.jdbc.core.JdbcTemplate
import org.springframework.stereotype.Component
@Component
class BookingSchemaFix(
private val jdbcTemplate: JdbcTemplate
) : PostgresSchemaFix(jdbcTemplate) {
override fun runPostgres(jdbcTemplate: JdbcTemplate) {
val hasExpectedGuestCount = jdbcTemplate.queryForObject(
"""
select count(*)
from information_schema.columns
where table_name = 'booking'
and column_name = 'expected_guest_count'
""".trimIndent(),
Int::class.java
) ?: 0
if (hasExpectedGuestCount == 0) {
logger.info("Adding booking.expected_guest_count column")
jdbcTemplate.execute("alter table booking add column expected_guest_count integer")
}
}
}