Help us shape the future of Go! Take the 2026 Go Developer Survey

mysql2postgres

package
v1.21.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package mysql2postgres copies the data of a MySQL or MariaDB installation into a PostgreSQL database whose schema the migrations created: the rows of the tables and columns both databases have, in foreign-key order, for the migrate mysql2postgres command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(ctx context.Context, cfg Config) error

Migrate copies the rows of every table and column the MySQL source and the PostgreSQL target share, then advances the target's sequences past the copied ids. A dry run only prints the plan.

func Run

func Run(ctx context.Context, args []string) error

Run parses the command-line arguments and migrates.

Types

type Config

type Config struct {
	MySQLDSN    string
	PostgresDSN string
	Schema      string
	Tables      string
	Exclude     string
	Truncate    bool
	Yes         bool
	DryRun      bool
	BatchSize   int
	// Location is the IANA zone the MySQL DATETIME values are in: the
	// panel's AppLocation (the session zone of its MySQL connection). A
	// MySQL DSN without a loc parameter reads them in this zone, and
	// timestamps that arrive as text are parsed in it, so the copied
	// instants are right; the process's own zone plays no part.
	Location string
}

Config is a migration run, as the command's flags set it.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig is the configuration before the flags apply: the public schema, a progress line every 1000 rows and the application's default zone.

func ParseFlags

func ParseFlags(args []string) (Config, error)

ParseFlags reads the migration's configuration from command-line arguments.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL