Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions apis/migrator/v1alpha1/mysql.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
Copyright AppsCode Inc. and Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

type MySQLSource struct {
// ConnectionInfo refers to the source MySQL database connection information.
ConnectionInfo *MySQLConnectionInfo `yaml:"connectionInfo" json:"connectionInfo"`
Schema *MySQLSchema `yaml:"schema" json:"schema,omitempty"`
Snapshot *MySQLSnapshot `yaml:"snapshot" json:"snapshot,omitempty"`
Streaming *MySQLStreaming `yaml:"streaming" json:"streaming,omitempty"`
}

type MySQLTarget struct {
// ConnectionInfo refers to the target MySQL database connection information.
ConnectionInfo *MySQLConnectionInfo `yaml:"connectionInfo" json:"connectionInfo"`
}

type MySQLSchema struct {
// Enabled controls whether the Schema Phase should be executed.
Enabled bool `yaml:"enabled" json:"enabled"`
// Database is the list of databases to migrate.
// +optional
Database []string `yaml:"database" json:"database,omitempty"`
// ExcludeDatabase is the list of databases to exclude from migration.
// +optional
ExcludeDatabase []string `yaml:"excludeDatabase" json:"excludeDatabase,omitempty"`
}

type MySQLSnapshot struct {
// Enabled controls whether the Snapshot Phase should be executed.
// +optional
Enabled bool `yaml:"enabled" json:"enabled"`
Pipeline *MySQLSnapshotPipeline `yaml:"pipeline" json:"pipeline,omitempty"`
}

type MySQLStreaming struct {
// Enabled controls whether the Logical Replication Phase should be executed.
// +optional
Enabled bool `yaml:"enabled" json:"enabled"`
}

type MySQLConnectionInfo struct {
Address string `yaml:"address" json:"address"`
User string `yaml:"user" json:"user"`
Password string `yaml:"password" json:"password"`
DBName string `yaml:"dbName" json:"dbName"`
MaxConnections int `yaml:"maxConnections" json:"maxConnections,omitempty"`
}

type MySQLSnapshotPipeline struct {
Workers *int `yaml:"workers" json:"workers"`
Sinkers *int `yaml:"sinkers" json:"sinkers"`
Buffer *int `yaml:"buffer" json:"buffer"`
ReadBatchSize *int `yaml:"readBatchSize" json:"read_batch_size"`
WriteBatchSize *int `yaml:"writeBatchSize" json:"write_batch_size"`
}
4 changes: 4 additions & 0 deletions apis/migrator/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ type MigrationConfig struct {
type Source struct {
// Postgres refers to the source Postgres database configuration
Postgres *PostgresSource `yaml:"postgres" json:"postgres,omitempty"`
// MySQL refers to the source MySQL database configuration
MySQL *MySQLSource `yaml:"mysql" json:"mysql,omitempty"`
}

// Target defines the target database configuration
type Target struct {
// Postgres refers to the target Postgres database configuration
Postgres *PostgresTarget `yaml:"postgres" json:"postgres,omitempty"`
// MySQL refers to the target MySQL database configuration
MySQL *MySQLTarget `yaml:"mysql" json:"mysql,omitempty"`
}

type ConnectionInfo struct {
Expand Down