All checks were successful
CI / Test (1.24) (push) Successful in -25m5s
CI / Test (1.25) (push) Successful in -24m57s
CI / Build (push) Successful in -26m5s
CI / Lint (push) Successful in -25m51s
Integration Tests / Integration Tests (push) Successful in -25m42s
Release / Build and Release (push) Successful in -24m39s
* Introduce `--flatten-schema` flag to convert, merge, and split commands. * Modify database writing functions to support flattened schema names. * Update template functions to handle schema.table naming convention. * Enhance PostgreSQL writer to utilize flattened schema in generated SQL. * Update tests to ensure compatibility with new flattening feature. * Dependencies updated for improved functionality.
19 lines
484 B
Cheetah
19 lines
484 B
Cheetah
DO $$
|
|
DECLARE
|
|
m_cnt bigint;
|
|
BEGIN
|
|
IF EXISTS (
|
|
SELECT 1 FROM pg_class c
|
|
INNER JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
WHERE c.relname = '{{.SequenceName}}'
|
|
AND n.nspname = '{{.SchemaName}}'
|
|
AND c.relkind = 'S'
|
|
) THEN
|
|
SELECT COALESCE(MAX({{quote_ident .ColumnName}}), 0) + 1
|
|
FROM {{qual_table .SchemaName .TableName}}
|
|
INTO m_cnt;
|
|
|
|
PERFORM setval('{{qual_table_raw .SchemaName .SequenceName}}'::regclass, m_cnt);
|
|
END IF;
|
|
END;
|
|
$$; |