feat: 添加分区表空间配置,确保创建分区时指定表空间
This commit is contained in:
@@ -2,6 +2,7 @@ import { logger } from '../utils/logger.js';
|
|||||||
import dbManager from './databaseManager.js';
|
import dbManager from './databaseManager.js';
|
||||||
|
|
||||||
const PARENT_TABLE = 'rcu_action.rcu_action_events';
|
const PARENT_TABLE = 'rcu_action.rcu_action_events';
|
||||||
|
const PARTITION_TABLESPACE = 'ts_hot';
|
||||||
const PARENT_INDEX_STATEMENTS = [
|
const PARENT_INDEX_STATEMENTS = [
|
||||||
'CREATE INDEX IF NOT EXISTS idx_rcu_action_hotel_id ON rcu_action.rcu_action_events (hotel_id);',
|
'CREATE INDEX IF NOT EXISTS idx_rcu_action_hotel_id ON rcu_action.rcu_action_events (hotel_id);',
|
||||||
'CREATE INDEX IF NOT EXISTS idx_rcu_action_room_id ON rcu_action.rcu_action_events (room_id);',
|
'CREATE INDEX IF NOT EXISTS idx_rcu_action_room_id ON rcu_action.rcu_action_events (room_id);',
|
||||||
@@ -71,7 +72,8 @@ class PartitionManager {
|
|||||||
const createSql = `
|
const createSql = `
|
||||||
CREATE TABLE IF NOT EXISTS ${partitionName}
|
CREATE TABLE IF NOT EXISTS ${partitionName}
|
||||||
PARTITION OF ${PARENT_TABLE}
|
PARTITION OF ${PARENT_TABLE}
|
||||||
FOR VALUES FROM (${startMs}) TO (${endMs});
|
FOR VALUES FROM (${startMs}) TO (${endMs})
|
||||||
|
TABLESPACE ${PARTITION_TABLESPACE};
|
||||||
`;
|
`;
|
||||||
await client.query(createSql);
|
await client.query(createSql);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user