Lightweight
0.20261105.1
Loading...
Searching...
No Matches
PostgreSqlForeignKeys.hpp
1
// SPDX-License-Identifier: Apache-2.0
2
//
3
// Internal to the Lightweight library (not installed): scripts the PostgreSQL foreign keys
4
// that touch columns about to change type, so `MigrationManager::UnicodeUpgradeTables` can
5
// drop them by their catalog names and recreate them exactly.
6
7
#pragma once
8
9
#include "SqlServerDependentObjects.hpp"
10
11
#include <vector>
12
13
namespace
Lightweight
14
{
15
16
class
SqlStatement;
17
18
namespace
detail
19
{
20
21
/// Reads the PostgreSQL catalog and scripts every foreign key with a column of `columns` on
22
/// either side, under its own name and with its own definition (columns, referenced table
23
/// with its schema, ON DELETE / ON UPDATE actions, deferrability).
24
///
25
/// Reads the definitions with only `pg_catalog` on `search_path`, so that they name every
26
/// referenced table with its schema, and restores the caller's path (transaction-local) before
27
/// it returns. Partition clones of a key are left to the key on the partitioned table.
28
///
29
/// @param stmt Statement on a PostgreSQL connection, inside the transaction of the change.
30
/// @param columns Columns about to be retyped; each carries its schema.
31
/// @return The drop / recreate script (`descriptions` stays empty, `needsAnsiWarnings` false).
32
[[nodiscard]] DependentObjectScript ScriptPostgreSqlForeignKeys(SqlStatement& stmt,
33
std::vector<ColumnToRetype>
const
& columns);
34
35
}
// namespace detail
36
37
}
// namespace Lightweight
Lightweight
PostgreSqlForeignKeys.hpp
Generated by
1.9.8