# README
Go La Tengo
Golang library for MySQL and MariaDB database automation
PlanetScale fork
This is a fork of upstream https://github.com/skeema/tengo
It has a few modifications specific to Vitess that do not make sense to add upstream.
Otherwise it adds some changes that make sense to contribute back. We generate patch files for those, and we are happy if upstream receives them.
PlanetScale: use ./planetscale/release.sh
to generate new releases (both for close-tracking of upstream as well as stripped down release for Vitess)
Features
Schema introspection and diff
Go La Tengo examines several information_schema
tables in order to build Go struct values representing schemas (databases), tables, columns, indexes, foreign key constraints, stored procedures, and functions. These values can be diff'ed to generate corresponding DDL statements.
Instance modeling
The tengo.Instance
struct models a single database instance. It keeps track of multiple, separate connection pools for using different default schema and session settings. This helps to avoid problems with Go's database/sql methods, which are incompatible with USE statements and SET SESSION statements.
Status
This is package is battle-tested from years of production use at many companies. The release numbering is still pre-1.0 though as the API is subject to minor changes. Backwards-incompatible changes are generally avoided whenever possible, but no guarantees are made.
As of September 2021, open source development of this repo is mostly frozen until further notice.
Supported databases
Tagged releases are tested against the following databases, all running on Linux:
- MySQL 5.5 - 8.0
- Percona Server 5.5 - 8.0
- MariaDB 10.1 - 10.6
Outside of a tagged release, every commit to the main branch is automatically tested against MySQL 5.7 and 8.0.
Unsupported in table diffs
Go La Tengo cannot diff tables containing any of the following MySQL features:
- spatial indexes
- sub-partitioning (two levels of partitioning in the same table)
- special features of non-InnoDB storage engines
Go La Tengo also does not yet support rename operations, e.g. column renames or table renames.
Ignored object types
The following object types are completely ignored by this package. Their presence won't break anything, but they will not be introspected or represented by the structs in this package.
- views
- triggers
- events
- grants / users / roles
External Dependencies
- https://github.com/go-sql-driver/mysql (Mozilla Public License 2.0)
- https://github.com/jmoiron/sqlx (MIT License)
- https://github.com/VividCortex/mysqlerr (MIT License)
- https://github.com/fsouza/go-dockerclient (BSD License)
- https://github.com/pmezard/go-difflib/difflib (BSD License)
- https://github.com/nozzle/throttler (Apache License 2.0)
- https://golang.org/x/sync/errgroup (BSD License)
Credits
Created and maintained by @evanelias.
Additional contributions by:
Support for stored procedures and functions generously sponsored by Psyonix.
Support for partitioned tables generously sponsored by Etsy.
License
Copyright 2021 Skeema LLC
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.