helpers

package
v1.0.1-0...-b7ad348 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DUMP_MODE              = "dumpFile"
	DIRECT_CONNECT_MODE    = "directConnect"
	SESSION_FILE_MODE      = "sessionFile"
	SCHEMA_ONLY            = "Schema"
	DATA_ONLY              = "Data"
	LOW_DOWNTIME_MIGRATION = "lowdt"
	POSTGRESQL_DIALECT     = "PostgreSQL"
	GOOGLE_SQL_DIALECT     = "Google Standard SQL"
)

Variables

View Source
var TABLE_STATEMENTS = []string{
	`CREATE TABLE IF NOT EXISTS SchemaConversionSession (
		VersionId STRING(36) NOT NULL,
		PreviousVersionId ARRAY<STRING(36)>,
		SessionName STRING(50) NOT NULL,
		EditorName STRING(100) NOT NULL,
		DatabaseType STRING(50) NOT NULL,
		DatabaseName STRING(50) NOT NULL,
		Dialect STRING(50) NOT NULL,
		Notes ARRAY<STRING(MAX)> NOT NULL,
		Tags ARRAY<STRING(20)>,
		SchemaChanges STRING(MAX),
		SchemaConversionObject JSON NOT NULL,
		CreateTimestamp TIMESTAMP NOT NULL,
	  ) PRIMARY KEY(VersionId)`,
	`CREATE TABLE IF NOT EXISTS SMT_JOB (
		JobId STRING(100) NOT NULL,
		JobName STRING(100) NOT NULL,
		JobType STRING(100) NOT NULL,
		JobStateData JSON,
		JobData JSON,
		Dialect STRING(50) NOT NULL,
		SpannerDatabaseName STRING(100) NOT NULL,
		CreatedAt TIMESTAMP NOT NULL OPTIONS (allow_commit_timestamp=true),
		UpdatedAt TIMESTAMP NOT NULL OPTIONS (allow_commit_timestamp=true),
	  ) PRIMARY KEY(JobId)`,
	`CREATE TABLE IF NOT EXISTS SMT_JOB_HISTORY (
		JobId STRING(100) NOT NULL,
		JobName STRING(100) NOT NULL,
		JobType STRING(100) NOT NULL,
		JobStateData JSON,
		JobData JSON,
		Dialect STRING(50) NOT NULL,
		SpannerDatabaseName STRING(100) NOT NULL,
		CreatedAt TIMESTAMP NOT NULL OPTIONS (allow_commit_timestamp=true),
	  ) PRIMARY KEY(JobId, CreatedAt)`,
	`CREATE TABLE IF NOT EXISTS SMT_RESOURCE (
		ResourceId STRING(100) NOT NULL,
		JobId STRING(100) NOT NULL,
		ExternalId STRING(100),
		ResourceName STRING(100) NOT NULL,
		ResourceType STRING(100) NOT NULL,
		ResourceStateData JSON,
		ResourceData JSON,
		CreatedAt TIMESTAMP NOT NULL OPTIONS (allow_commit_timestamp=true),
		UpdatedAt TIMESTAMP NOT NULL OPTIONS (allow_commit_timestamp=true),
	  ) PRIMARY KEY(ResourceId)`,
	`CREATE TABLE IF NOT EXISTS SMT_RESOURCE_HISTORY (
		ResourceId STRING(100) NOT NULL,
		JobId STRING(100) NOT NULL,
		ExternalId STRING(100),
		ResourceName STRING(100) NOT NULL,
		ResourceType STRING(100) NOT NULL,
		ResourceStateData JSON,
		ResourceData JSON,
		CreatedAt TIMESTAMP NOT NULL OPTIONS (allow_commit_timestamp=true),
	) PRIMARY KEY(ResourceId, CreatedAt)`,
}

Functions

func CheckOrCreateMetadataDb

func CheckOrCreateMetadataDb(projectId string, instanceId string) bool

func GetDialectDisplayStringFromDialect

func GetDialectDisplayStringFromDialect(dialect string) string

func GetSourceDatabaseFromDriver

func GetSourceDatabaseFromDriver(driver string) (string, error)

func GetSpannerUri

func GetSpannerUri(projectId string, instanceId string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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