feat: require hospital code and add company APIs

This commit is contained in:
2026-08-28 10:30:08 +07:00
parent a59b2c6443
commit 8dd880003d
17 changed files with 867 additions and 142 deletions

View File

@@ -7,7 +7,6 @@ CREATE TABLE IF NOT EXISTS hospitals (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
code VARCHAR(50) NOT NULL,
name VARCHAR(150) NOT NULL,
is_default TINYINT(1) NOT NULL DEFAULT 0,
active TINYINT(1) NOT NULL DEFAULT 1,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

View File

@@ -0,0 +1,17 @@
USE `cpone_middleware`;
SET @drop_default_column = IF(
EXISTS(
SELECT 1
FROM information_schema.columns
WHERE table_schema = DATABASE()
AND table_name = 'hospitals'
AND column_name = 'is_default'
),
'ALTER TABLE hospitals DROP COLUMN is_default',
'SELECT 1'
);
PREPARE drop_default_statement FROM @drop_default_column;
EXECUTE drop_default_statement;
DEALLOCATE PREPARE drop_default_statement;