fix(transfer): allow unquoted gaussdb transfer identifiers
This commit is contained in:
22 files changed
+423
-53
No files matched your search
@@ -31,6 +31,7 @@ function makeConfig(overrides: Partial<TransferTaskConfig> = {}): TransferTaskCo
|
||||
content: "structureAndData",
|
||||
mode: "append",
|
||||
targetTableNameCase: "preserve",
|
||||
quoteTargetColumnNames: true,
|
||||
batchSize: 1000,
|
||||
...overrides,
|
||||
};
|
||||
@@ -66,6 +67,21 @@ describe("transferTaskStore", () => {
|
||||
expect(store.listTasks("folder-1").map((task) => task.id)).toEqual(["task-1"]);
|
||||
});
|
||||
|
||||
it("keeps target column quoting enabled for saved tasks created before the option existed", async () => {
|
||||
const legacyConfig = makeConfig() as Partial<TransferTaskConfig>;
|
||||
delete legacyConfig.quoteTargetColumnNames;
|
||||
vi.mocked(api.loadTransferTaskLibrary).mockResolvedValue({
|
||||
version: 1,
|
||||
folders: [],
|
||||
tasks: [{ id: "legacy", name: "legacy", config: legacyConfig, createdAt: "2026-01-01T00:00:00.000Z", updatedAt: "2026-01-01T00:00:00.000Z" }],
|
||||
} as unknown as TransferTaskLibrary);
|
||||
|
||||
const store = useTransferTaskStore();
|
||||
await store.initFromStorage();
|
||||
|
||||
expect(store.tasks[0]?.config.quoteTargetColumnNames).toBe(true);
|
||||
});
|
||||
|
||||
it("refuses to overwrite a persisted library with invalid entries", async () => {
|
||||
vi.mocked(api.loadTransferTaskLibrary).mockResolvedValue({
|
||||
version: 1,
|
||||
|
||||
@@ -89,6 +89,7 @@ function normalizeTask(raw: unknown): TransferTask | null {
|
||||
content: config.content ?? "structureAndData",
|
||||
mode: config.mode ?? "append",
|
||||
targetTableNameCase: config.targetTableNameCase ?? "preserve",
|
||||
quoteTargetColumnNames: config.quoteTargetColumnNames ?? true,
|
||||
batchSize: typeof config.batchSize === "number" && config.batchSize > 0 ? config.batchSize : 1000,
|
||||
},
|
||||
createdAt: candidate.createdAt || nowIso(),
|
||||
|
||||
Reference in new issue
Block a user