Skip to content

GCP.DataMigration reference

Source: src/GCP/DataMigration/ConnectionProfile.ts

A Database Migration Service connection profile: credentials and connectivity for a source database, or settings used to provision a Cloud SQL / AlloyDB destination.

connectionProfileId, location, and the engine kind (mysql / postgresql / oracle / sqlserver / cloudsql / alloydb) plus immutable Cloud SQL / AlloyDB settings are replacement triggers. Display name, labels, role, provider, and credential fields update in place. Passwords are input-only and never returned.

ConnectionProfile: Creating a Connection Profile

Section titled “ConnectionProfile: Creating a Connection Profile”

MySQL source

const source = yield* GCP.DataMigration.ConnectionProfile("MysqlSrc", {
mysql: {
host: "10.0.0.8",
port: 3306,
username: "dms",
password: process.env.MYSQL_PASSWORD,
},
labels: { env: "test" },
});

Cloud SQL destination

const dest = yield* GCP.DataMigration.ConnectionProfile("MysqlDest", {
cloudsql: {
settings: {
sourceId: source.name,
databaseVersion: "MYSQL_8_0",
tier: "db-n1-standard-1",
rootPassword: process.env.MYSQL_ROOT_PASSWORD,
},
},
});

Source: src/GCP/DataMigration/ConversionWorkspace.ts

A Database Migration Service conversion workspace: source and destination engines plus optional mapping-engine settings used by heterogeneous migrations.

Conversion workspaces have no labels field — Alchemy stamps ownership into the display name so list / nuke can find them. source, destination, and their providers are replacement triggers. Display name and globalSettings update in place.

ConversionWorkspace: Creating a Conversion Workspace

Section titled “ConversionWorkspace: Creating a Conversion Workspace”

MySQL to PostgreSQL

const workspace = yield* GCP.DataMigration.ConversionWorkspace("MysqlToPg", {
displayName: "mysql-to-pg",
source: { engine: "MYSQL", version: "8.0" },
destination: { engine: "POSTGRESQL", version: "14" },
});

Oracle to PostgreSQL with settings

const workspace = yield* GCP.DataMigration.ConversionWorkspace("OraToPg", {
source: { engine: "ORACLE", version: "19" },
destination: { engine: "POSTGRESQL", version: "15" },
globalSettings: { skip_triggers: "true" },
});

Source: src/GCP/DataMigration/ConversionWorkspacesMappingRule.ts

A mapping rule attached to a Database Migration Service conversion workspace. Rules transform source schema entities into the destination schema (rename, move, type change, …).

Mapping rules have no labels field and no patch method — Alchemy stamps ownership into the display name, and any change to the rule body replaces the rule.

ConversionWorkspacesMappingRule: Creating a Mapping Rule

Section titled “ConversionWorkspacesMappingRule: Creating a Mapping Rule”
const workspace = yield* GCP.DataMigration.ConversionWorkspace("MysqlToPg", {
source: { engine: "MYSQL", version: "8.0" },
destination: { engine: "POSTGRESQL", version: "14" },
});
const rule = yield* GCP.DataMigration.ConversionWorkspacesMappingRule("Rename", {
conversionWorkspace: workspace.name,
ruleScope: "DATABASE_ENTITY_TYPE_SCHEMA",
filter: { entities: ["src_schema"] },
singleEntityRename: { newName: "dst_schema" },
});

Source: src/GCP/DataMigration/MigrationJob.ts

A Database Migration Service migration job: copies data from a source connection profile to a destination (Cloud SQL or AlloyDB).

migrationJobId, location, type, source, destination, and cmekKeyName are replacement triggers. Display name, labels, dump flags, connectivity, and performance config update in place. Delete force-deletes the destination Cloud SQL replica.

const source = yield* GCP.DataMigration.ConnectionProfile("MysqlSrc", {
mysql: {
host: "10.0.0.8",
port: 3306,
username: "dms",
password: process.env.MYSQL_PASSWORD,
},
});
const dest = yield* GCP.DataMigration.ConnectionProfile("MysqlDest", {
cloudsql: {
settings: {
sourceId: source.name,
databaseVersion: "MYSQL_8_0",
tier: "db-n1-standard-1",
rootPassword: process.env.MYSQL_ROOT_PASSWORD,
},
},
});
const job = yield* GCP.DataMigration.MigrationJob("Replica", {
type: "CONTINUOUS",
source: source.name,
destination: dest.name,
staticIpConnectivity: {},
});

Source: src/GCP/DataMigration/PrivateConnection.ts

A Database Migration Service private connection: VPC peering or a PSC interface between DMS and a consumer network.

The API has no patch method. privateConnectionId, location, vpcPeeringConfig, pscInterfaceConfig, display name, and labels are replacement triggers.

PrivateConnection: Creating a Private Connection

Section titled “PrivateConnection: Creating a Private Connection”
const network = yield* GCP.Compute.Network("DmsVpc", {
autoCreateSubnetworks: false,
});
const peering = yield* GCP.DataMigration.PrivateConnection("DmsPeer", {
displayName: "dms-peer",
vpcPeeringConfig: {
vpcName: network.selfLink ?? network.networkName,
subnet: "10.8.0.0/29",
},
labels: { env: "test" },
});