modulepackage
0.0.0-20250206134312-7653a68c87f0
Repository: https://github.com/morikuni/spannerdiff.git
Documentation: pkg.go.dev
# README
spannerdiff
Schema migration tool for Cloud Spanner.
Note: This tool is currently under development. The interface may change.
Installation
$ brew install morikuni/tap/spannerdiff
Supported DDL
CREATE SCHEMA
CREATE TABLE
CREATE INDEX
CREATE SEARCH INDEX
CREATE PROPERTY GRAPH
CREATE VIEW
CREATE CHANGE STREAM
CREATE SEQUENCE
CREATE VECTOR INDEX
CREATE MODEL
CREATE PROTO BUNDLE
CREATE ROLE
GRANT
ALTER DATABASE
Colored Output
Example
$ gcloud spanner databases ddl describe test
CREATE TABLE Test (
ID STRING(64) NOT NULL,
Name STRING(64) NOT NULL,
) PRIMARY KEY (ID);
CREATE INDEX Test_Name ON Test (Name);
$ cat schema.sql
CREATE TABLE Test (
ID STRING(64) NOT NULL,
Name STRING(64) NOT NULL,
CreatedAt TIMESTAMP NOT NULL DEFAULT (CURRENT_TIMESTAMP()),
) PRIMARY KEY (ID);
CREATE INDEX Test_Name_CreatedAt ON Test (Name, CreatedAt DESC);
$ gcloud spanner databases ddl describe test | spannerdiff --base-stdin --target-file=schema.sql | tee tmp.sql
DROP INDEX Test_Name;
ALTER TABLE Test ADD COLUMN CreatedAt TIMESTAMP NOT NULL DEFAULT (CURRENT_TIMESTAMP());
CREATE INDEX Test_Name_CreatedAt ON Test(Name, CreatedAt DESC);
$ gcloud spanner databases ddl update test --ddl-file=tmp.sql
Schema updating...done.
Known Issues & Limitations
- View DDL generation may be incorrect or out of order due to unresolved column names in the view query.
# Packages
No description provided by the author
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author
# Type aliases
No description provided by the author