From 90273fe0aa0e213408ddc106eb9747b0c4462495 Mon Sep 17 00:00:00 2001 From: Luca Nardelli Date: Tue, 29 Nov 2022 15:46:06 +0100 Subject: [PATCH 01/32] clickhouse: Quote db name in ensureVersionTable --- database/clickhouse/clickhouse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/clickhouse/clickhouse.go b/database/clickhouse/clickhouse.go index ee1ac209f..5e7193e8b 100644 --- a/database/clickhouse/clickhouse.go +++ b/database/clickhouse/clickhouse.go @@ -220,7 +220,7 @@ func (ch *ClickHouse) ensureVersionTable() (err error) { var ( table string - query = "SHOW TABLES FROM " + ch.config.DatabaseName + " LIKE '" + ch.config.MigrationsTable + "'" + query = "SHOW TABLES FROM \"" + ch.config.DatabaseName + "\" LIKE '" + ch.config.MigrationsTable + "'" ) // check if migration table exists if err := ch.conn.QueryRow(query).Scan(&table); err != nil { From 9fe7383564b0378fddd3b0051b863384da5d0906 Mon Sep 17 00:00:00 2001 From: Luca Nardelli Date: Wed, 30 Nov 2022 10:26:31 +0100 Subject: [PATCH 02/32] Quote in drop as well --- database/clickhouse/clickhouse.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/clickhouse/clickhouse.go b/database/clickhouse/clickhouse.go index 5e7193e8b..e9f3a35c0 100644 --- a/database/clickhouse/clickhouse.go +++ b/database/clickhouse/clickhouse.go @@ -259,7 +259,7 @@ func (ch *ClickHouse) ensureVersionTable() (err error) { } func (ch *ClickHouse) Drop() (err error) { - query := "SHOW TABLES FROM " + ch.config.DatabaseName + query := "SHOW TABLES FROM \"" + ch.config.DatabaseName + "\"" tables, err := ch.conn.Query(query) if err != nil { @@ -277,7 +277,7 @@ func (ch *ClickHouse) Drop() (err error) { return err } - query = "DROP TABLE IF EXISTS " + ch.config.DatabaseName + "." + table + query = "DROP TABLE IF EXISTS \"" + ch.config.DatabaseName + "\"." + table if _, err := ch.conn.Exec(query); err != nil { return &database.Error{OrigErr: err, Query: []byte(query)} From 839421e733996942847e55681a4e959d79cdd06d Mon Sep 17 00:00:00 2001 From: Luca Nardelli Date: Wed, 30 Nov 2022 14:38:22 +0100 Subject: [PATCH 03/32] Leverage quoteIdentifier from pgx --- database/clickhouse/clickhouse.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/database/clickhouse/clickhouse.go b/database/clickhouse/clickhouse.go index e9f3a35c0..d2b65c0ce 100644 --- a/database/clickhouse/clickhouse.go +++ b/database/clickhouse/clickhouse.go @@ -220,7 +220,7 @@ func (ch *ClickHouse) ensureVersionTable() (err error) { var ( table string - query = "SHOW TABLES FROM \"" + ch.config.DatabaseName + "\" LIKE '" + ch.config.MigrationsTable + "'" + query = "SHOW TABLES FROM " + quoteIdentifier(ch.config.DatabaseName) + " LIKE '" + ch.config.MigrationsTable + "'" ) // check if migration table exists if err := ch.conn.QueryRow(query).Scan(&table); err != nil { @@ -259,7 +259,7 @@ func (ch *ClickHouse) ensureVersionTable() (err error) { } func (ch *ClickHouse) Drop() (err error) { - query := "SHOW TABLES FROM \"" + ch.config.DatabaseName + "\"" + query := "SHOW TABLES FROM " + quoteIdentifier(ch.config.DatabaseName) tables, err := ch.conn.Query(query) if err != nil { @@ -277,7 +277,7 @@ func (ch *ClickHouse) Drop() (err error) { return err } - query = "DROP TABLE IF EXISTS \"" + ch.config.DatabaseName + "\"." + table + query = "DROP TABLE IF EXISTS " + quoteIdentifier(ch.config.DatabaseName) + "." + quoteIdentifier(table) if _, err := ch.conn.Exec(query); err != nil { return &database.Error{OrigErr: err, Query: []byte(query)} @@ -305,3 +305,12 @@ func (ch *ClickHouse) Unlock() error { return nil } func (ch *ClickHouse) Close() error { return ch.conn.Close() } + +// Copied from lib/pq implementation: https://github.com/lib/pq/blob/v1.9.0/conn.go#L1611 +func quoteIdentifier(name string) string { + end := strings.IndexRune(name, 0) + if end > -1 { + name = name[:end] + } + return `"` + strings.Replace(name, `"`, `""`, -1) + `"` +} From 50112e7650a727a96a5fed491fd0a5e339f9fc11 Mon Sep 17 00:00:00 2001 From: Viktoria Date: Tue, 24 Jan 2023 12:40:36 +0300 Subject: [PATCH 04/32] Add to clickhouse README.md database creation --- database/clickhouse/README.md | 1 + .../migrations/003_create_database.down.sql | 10 +++ .../migrations/003_create_database.up.sql | 81 +++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 database/clickhouse/examples/migrations/003_create_database.down.sql create mode 100644 database/clickhouse/examples/migrations/003_create_database.up.sql diff --git a/database/clickhouse/README.md b/database/clickhouse/README.md index 96ad79f1c..a0a6b7ca3 100644 --- a/database/clickhouse/README.md +++ b/database/clickhouse/README.md @@ -23,3 +23,4 @@ * Clickhouse cluster mode is not officially supported, since it's not tested right now, but you can try enabling `schema_migrations` table replication by specifying a `x-cluster-name`: * When `x-cluster-name` is specified, `x-migrations-table-engine` also should be specified. See the docs regarding [replicated table engines](https://clickhouse.tech/docs/en/engines/table-engines/mergetree-family/replication/#table_engines-replication). * When `x-cluster-name` is specified, only the `schema_migrations` table is replicated across the cluster. You still need to write your migrations so that the application tables are replicated within the cluster. +* If you want to create database inside the migration, you should know, that table which will manage migrations `schema-migrations table` will be in `deafault` table, so you can't use `USE ` inside migration. In this case you can not specify the database in the connection string (example you can find [here](examples/migrations/003_create_database.up.sql)) \ No newline at end of file diff --git a/database/clickhouse/examples/migrations/003_create_database.down.sql b/database/clickhouse/examples/migrations/003_create_database.down.sql new file mode 100644 index 000000000..8e49cfbfa --- /dev/null +++ b/database/clickhouse/examples/migrations/003_create_database.down.sql @@ -0,0 +1,10 @@ +DROP TABLE IF EXISTS driver_ratings ON CLUSTER cluster_1; +DROP TABLE IF EXISTS user_ratings ON CLUSTER cluster_1; +DROP TABLE IF EXISTS orders ON CLUSTER cluster_1; +DROP TABLE IF EXISTS driver_ratings_queue ON CLUSTER cluster_1; +DROP TABLE IF EXISTS user_ratings_queue ON CLUSTER cluster_1; +DROP TABLE IF EXISTS orders_queue ON CLUSTER cluster_1; +DROP VIEW IF EXISTS user_ratings_queue_mv ON CLUSTER cluster_1; +DROP VIEW IF EXISTS driver_ratings_queue_mv ON CLUSTER cluster_1; +DROP VIEW IF EXISTS orders_queue_mv ON CLUSTER cluster_1; +DROP DATABASE IF EXISTS analytics ON CLUSTER cluster_1; diff --git a/database/clickhouse/examples/migrations/003_create_database.up.sql b/database/clickhouse/examples/migrations/003_create_database.up.sql new file mode 100644 index 000000000..b49d66913 --- /dev/null +++ b/database/clickhouse/examples/migrations/003_create_database.up.sql @@ -0,0 +1,81 @@ +CREATE DATABASE IF NOT EXISTS analytics ON CLUSTER cluster_1; + +CREATE TABLE IF NOT EXISTS analytics.driver_ratings ON CLUSTER cluster_1( + rate UInt8, + userID Int64, + driverID String, + orderID String, + inserted_time DateTime DEFAULT now() +) ENGINE = ReplicatedMergeTree +PARTITION BY driverID +ORDER BY (inserted_time); + +CREATE TABLE analytics.driver_ratings_queue ON CLUSTER cluster_1( + rate UInt8, + userID Int64, + driverID String, + orderID String +) ENGINE = Kafka +SETTINGS kafka_broker_list = 'broker:9092', + kafka_topic_list = 'driver-ratings', + kafka_group_name = 'rating_readers', + kafka_format = 'Avro', + kafka_max_block_size = 1048576; + +CREATE MATERIALIZED VIEW analytics.driver_ratings_queue_mv ON CLUSTER cluster_1 TO analytics.driver_ratings AS +SELECT rate, userID, driverID, orderID +FROM analytics.driver_ratings_queue; + +CREATE TABLE IF NOT EXISTS analytics.user_ratings ON CLUSTER cluster_1( + rate UInt8, + userID Int64, + driverID String, + orderID String, + inserted_time DateTime DEFAULT now() +) ENGINE = ReplicatedMergeTree + PARTITION BY userID + ORDER BY (inserted_time); + +CREATE TABLE analytics.user_ratings_queue ON CLUSTER cluster_1( + rate UInt8, + userID Int64, + driverID String, + orderID String +) ENGINE = Kafka +SETTINGS kafka_broker_list = 'broker:9092', + kafka_topic_list = 'user-ratings', + kafka_group_name = 'rating_readers', + kafka_format = 'JSON', + kafka_max_block_size = 1048576; + +CREATE MATERIALIZED VIEW analytics.user_ratings_queue_mv ON CLUSTER cluster_1 TO analytics.user_ratings AS +SELECT rate, userID, driverID, orderID +FROM analytics.user_ratings_queue; + +CREATE TABLE IF NOT EXISTS analytics.orders ON CLUSTER cluster_1( + from_place String, + to_place String, + userID Int64, + driverID String, + orderID String, + inserted_time DateTime DEFAULT now() +) ENGINE = ReplicatedMergeTree + PARTITION BY driverID + ORDER BY (inserted_time); + +CREATE TABLE analytics.orders_queue ON CLUSTER cluster_1( + from_place String, + to_place String, + userID Int64, + driverID String, + orderID String +) ENGINE = Kafka +SETTINGS kafka_broker_list = 'broker:9092', + kafka_topic_list = 'orders', + kafka_group_name = 'order_readers', + kafka_format = 'Avro', + kafka_max_block_size = 1048576; + +CREATE MATERIALIZED VIEW analytics.orders_queue_mv ON CLUSTER cluster_1 TO orders AS +SELECT from_place, to_place, userID, driverID, orderID +FROM analytics.orders_queue; From 90a3ac4f870766aa363b6872998e2cec8ddaffbb Mon Sep 17 00:00:00 2001 From: Viktoria Date: Tue, 24 Jan 2023 13:22:17 +0300 Subject: [PATCH 05/32] Remove cluster adaptation for tables to pass tests --- .../migrations/003_create_database.down.sql | 20 +++++++------- .../migrations/003_create_database.up.sql | 26 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/database/clickhouse/examples/migrations/003_create_database.down.sql b/database/clickhouse/examples/migrations/003_create_database.down.sql index 8e49cfbfa..76d3cf32d 100644 --- a/database/clickhouse/examples/migrations/003_create_database.down.sql +++ b/database/clickhouse/examples/migrations/003_create_database.down.sql @@ -1,10 +1,10 @@ -DROP TABLE IF EXISTS driver_ratings ON CLUSTER cluster_1; -DROP TABLE IF EXISTS user_ratings ON CLUSTER cluster_1; -DROP TABLE IF EXISTS orders ON CLUSTER cluster_1; -DROP TABLE IF EXISTS driver_ratings_queue ON CLUSTER cluster_1; -DROP TABLE IF EXISTS user_ratings_queue ON CLUSTER cluster_1; -DROP TABLE IF EXISTS orders_queue ON CLUSTER cluster_1; -DROP VIEW IF EXISTS user_ratings_queue_mv ON CLUSTER cluster_1; -DROP VIEW IF EXISTS driver_ratings_queue_mv ON CLUSTER cluster_1; -DROP VIEW IF EXISTS orders_queue_mv ON CLUSTER cluster_1; -DROP DATABASE IF EXISTS analytics ON CLUSTER cluster_1; +DROP TABLE IF EXISTS driver_ratings; +DROP TABLE IF EXISTS user_ratings; +DROP TABLE IF EXISTS orders; +DROP TABLE IF EXISTS driver_ratings_queue; +DROP TABLE IF EXISTS user_ratings_queue; +DROP TABLE IF EXISTS orders_queue; +DROP VIEW IF EXISTS user_ratings_queue_mv; +DROP VIEW IF EXISTS driver_ratings_queue_mv; +DROP VIEW IF EXISTS orders_queue_mv; +DROP DATABASE IF EXISTS analytics; diff --git a/database/clickhouse/examples/migrations/003_create_database.up.sql b/database/clickhouse/examples/migrations/003_create_database.up.sql index b49d66913..de5038880 100644 --- a/database/clickhouse/examples/migrations/003_create_database.up.sql +++ b/database/clickhouse/examples/migrations/003_create_database.up.sql @@ -1,16 +1,16 @@ -CREATE DATABASE IF NOT EXISTS analytics ON CLUSTER cluster_1; +CREATE DATABASE IF NOT EXISTS analytics; -CREATE TABLE IF NOT EXISTS analytics.driver_ratings ON CLUSTER cluster_1( +CREATE TABLE IF NOT EXISTS analytics.driver_ratings( rate UInt8, userID Int64, driverID String, orderID String, inserted_time DateTime DEFAULT now() -) ENGINE = ReplicatedMergeTree +) ENGINE = MergeTree PARTITION BY driverID ORDER BY (inserted_time); -CREATE TABLE analytics.driver_ratings_queue ON CLUSTER cluster_1( +CREATE TABLE analytics.driver_ratings_queue( rate UInt8, userID Int64, driverID String, @@ -22,21 +22,21 @@ SETTINGS kafka_broker_list = 'broker:9092', kafka_format = 'Avro', kafka_max_block_size = 1048576; -CREATE MATERIALIZED VIEW analytics.driver_ratings_queue_mv ON CLUSTER cluster_1 TO analytics.driver_ratings AS +CREATE MATERIALIZED VIEW analytics.driver_ratings_queue_mv TO analytics.driver_ratings AS SELECT rate, userID, driverID, orderID FROM analytics.driver_ratings_queue; -CREATE TABLE IF NOT EXISTS analytics.user_ratings ON CLUSTER cluster_1( +CREATE TABLE IF NOT EXISTS analytics.user_ratings( rate UInt8, userID Int64, driverID String, orderID String, inserted_time DateTime DEFAULT now() -) ENGINE = ReplicatedMergeTree +) ENGINE = MergeTree PARTITION BY userID ORDER BY (inserted_time); -CREATE TABLE analytics.user_ratings_queue ON CLUSTER cluster_1( +CREATE TABLE analytics.user_ratings_queue( rate UInt8, userID Int64, driverID String, @@ -48,22 +48,22 @@ SETTINGS kafka_broker_list = 'broker:9092', kafka_format = 'JSON', kafka_max_block_size = 1048576; -CREATE MATERIALIZED VIEW analytics.user_ratings_queue_mv ON CLUSTER cluster_1 TO analytics.user_ratings AS +CREATE MATERIALIZED VIEW analytics.user_ratings_queue_mv TO analytics.user_ratings AS SELECT rate, userID, driverID, orderID FROM analytics.user_ratings_queue; -CREATE TABLE IF NOT EXISTS analytics.orders ON CLUSTER cluster_1( +CREATE TABLE IF NOT EXISTS analytics.orders( from_place String, to_place String, userID Int64, driverID String, orderID String, inserted_time DateTime DEFAULT now() -) ENGINE = ReplicatedMergeTree +) ENGINE = MergeTree PARTITION BY driverID ORDER BY (inserted_time); -CREATE TABLE analytics.orders_queue ON CLUSTER cluster_1( +CREATE TABLE analytics.orders_queue( from_place String, to_place String, userID Int64, @@ -76,6 +76,6 @@ SETTINGS kafka_broker_list = 'broker:9092', kafka_format = 'Avro', kafka_max_block_size = 1048576; -CREATE MATERIALIZED VIEW analytics.orders_queue_mv ON CLUSTER cluster_1 TO orders AS +CREATE MATERIALIZED VIEW analytics.orders_queue_mv TO orders AS SELECT from_place, to_place, userID, driverID, orderID FROM analytics.orders_queue; From 64755d0b20af559e5adf22d5f1ed45a121e7f5ad Mon Sep 17 00:00:00 2001 From: Viktoria Date: Tue, 24 Jan 2023 14:37:31 +0300 Subject: [PATCH 06/32] Update README.md --- database/clickhouse/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/clickhouse/README.md b/database/clickhouse/README.md index a0a6b7ca3..14de52931 100644 --- a/database/clickhouse/README.md +++ b/database/clickhouse/README.md @@ -23,4 +23,4 @@ * Clickhouse cluster mode is not officially supported, since it's not tested right now, but you can try enabling `schema_migrations` table replication by specifying a `x-cluster-name`: * When `x-cluster-name` is specified, `x-migrations-table-engine` also should be specified. See the docs regarding [replicated table engines](https://clickhouse.tech/docs/en/engines/table-engines/mergetree-family/replication/#table_engines-replication). * When `x-cluster-name` is specified, only the `schema_migrations` table is replicated across the cluster. You still need to write your migrations so that the application tables are replicated within the cluster. -* If you want to create database inside the migration, you should know, that table which will manage migrations `schema-migrations table` will be in `deafault` table, so you can't use `USE ` inside migration. In this case you can not specify the database in the connection string (example you can find [here](examples/migrations/003_create_database.up.sql)) \ No newline at end of file +* If you want to create database inside the migration, you should know, that table which will manage migrations `schema-migrations table` will be in `deafault` table, so you can't use `USE ` inside migration. In this case you may not specify the database in the connection string (example you can find [here](examples/migrations/003_create_database.up.sql)) \ No newline at end of file From 3b02b182eee9d36f27c79989bce31e13b3d2fc01 Mon Sep 17 00:00:00 2001 From: Viktoria <69359798+no-name16@users.noreply.github.com> Date: Sun, 19 Mar 2023 07:44:50 +0100 Subject: [PATCH 07/32] Correct a spelling mistake --- database/clickhouse/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/clickhouse/README.md b/database/clickhouse/README.md index 14de52931..a3cea9298 100644 --- a/database/clickhouse/README.md +++ b/database/clickhouse/README.md @@ -23,4 +23,4 @@ * Clickhouse cluster mode is not officially supported, since it's not tested right now, but you can try enabling `schema_migrations` table replication by specifying a `x-cluster-name`: * When `x-cluster-name` is specified, `x-migrations-table-engine` also should be specified. See the docs regarding [replicated table engines](https://clickhouse.tech/docs/en/engines/table-engines/mergetree-family/replication/#table_engines-replication). * When `x-cluster-name` is specified, only the `schema_migrations` table is replicated across the cluster. You still need to write your migrations so that the application tables are replicated within the cluster. -* If you want to create database inside the migration, you should know, that table which will manage migrations `schema-migrations table` will be in `deafault` table, so you can't use `USE ` inside migration. In this case you may not specify the database in the connection string (example you can find [here](examples/migrations/003_create_database.up.sql)) \ No newline at end of file +* If you want to create database inside the migration, you should know, that table which will manage migrations `schema-migrations table` will be in `default` table, so you can't use `USE ` inside migration. In this case you may not specify the database in the connection string (example you can find [here](examples/migrations/003_create_database.up.sql)) From 92dec355efcf607bb9db986785733cdb31fd4746 Mon Sep 17 00:00:00 2001 From: Sandro Date: Thu, 1 Jun 2023 11:09:09 +0200 Subject: [PATCH 08/32] Move supported go version to standard place --- go.mod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 92c278a94..d9b84deee 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,7 @@ module github.com/golang-migrate/migrate/v4 +go 1.18 + require ( cloud.google.com/go/spanner v1.44.0 cloud.google.com/go/storage v1.27.0 @@ -164,5 +166,3 @@ require ( modernc.org/token v1.0.0 // indirect modernc.org/zappy v1.0.0 // indirect ) - -go 1.18 From 7a72550614ccb1500223dddf537e924df008ecf2 Mon Sep 17 00:00:00 2001 From: Maxim Korolyov Date: Wed, 21 Jun 2023 21:55:23 +0200 Subject: [PATCH 09/32] add tests for scylladb. add scylladb to docs --- README.md | 1 + database/cassandra/README.md | 5 +++-- database/cassandra/cassandra_test.go | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3beed0076..ce4df2367 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Database drivers run migrations. [Add a new database?](database/driver.go) * [Redshift](database/redshift) * [Ql](database/ql) * [Cassandra](database/cassandra) +* [ScyllaDB](database/cassandra) * [SQLite](database/sqlite) * [SQLite3](database/sqlite3) ([todo #165](https://github.com/mattes/migrate/issues/165)) * [SQLCipher](database/sqlcipher) diff --git a/database/cassandra/README.md b/database/cassandra/README.md index 65ab0e62c..5cec0ab66 100644 --- a/database/cassandra/README.md +++ b/database/cassandra/README.md @@ -1,11 +1,12 @@ -# Cassandra +# Cassandra / ScyllaDB * Drop command will not work on Cassandra 2.X because it rely on -system_schema table which comes with 3.X +system_schema table which comes with 3.X. Works as expected for ScyllaDB. * Other commands should work properly but are **not tested** * The Cassandra driver (gocql) does not natively support executing multiple statements in a single query. To allow for multiple statements in a single migration, you can use the `x-multi-statement` param. There are two important caveats: * This mode splits the migration text into separately-executed statements by a semi-colon `;`. Thus `x-multi-statement` cannot be used when a statement in the migration contains a string with a semi-colon. * The queries are not executed in any sort of transaction/batch, meaning you are responsible for fixing partial migrations. +* For ScyllaDB no additional configuration required as it is a drop-in replacement for Cassandra. ## Usage diff --git a/database/cassandra/cassandra_test.go b/database/cassandra/cassandra_test.go index 2e0c40283..87d21d9a1 100644 --- a/database/cassandra/cassandra_test.go +++ b/database/cassandra/cassandra_test.go @@ -25,9 +25,11 @@ var ( // Although Cassandra 2.x is supported by the Apache Foundation, // the migrate db driver only supports Cassandra 3.x since it uses // the system_schema keyspace. + // last ScyllaDB version tested is 5.1.11 specs = []dktesting.ContainerSpec{ {ImageName: "cassandra:3.0", Options: opts}, {ImageName: "cassandra:3.11", Options: opts}, + {ImageName: "scylladb/scylla:5.1.11", Options: opts}, } ) From f8afa5a6f696dbc565ef4cb7bb464c6b6a5ce04e Mon Sep 17 00:00:00 2001 From: Maxim Korolyov Date: Mon, 17 Jul 2023 22:40:49 +0200 Subject: [PATCH 10/32] small changes to retry failed by timeout CI --- database/cassandra/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/cassandra/README.md b/database/cassandra/README.md index 5cec0ab66..c138dff62 100644 --- a/database/cassandra/README.md +++ b/database/cassandra/README.md @@ -1,7 +1,7 @@ # Cassandra / ScyllaDB * Drop command will not work on Cassandra 2.X because it rely on -system_schema table which comes with 3.X. Works as expected for ScyllaDB. +system_schema table which comes with 3.X. Works for ScyllaDB. * Other commands should work properly but are **not tested** * The Cassandra driver (gocql) does not natively support executing multiple statements in a single query. To allow for multiple statements in a single migration, you can use the `x-multi-statement` param. There are two important caveats: * This mode splits the migration text into separately-executed statements by a semi-colon `;`. Thus `x-multi-statement` cannot be used when a statement in the migration contains a string with a semi-colon. From 876a13d4232d25af1b01ffc0c71cb4951577b10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=9Areniawski?= Date: Tue, 18 Jul 2023 09:00:47 +0200 Subject: [PATCH 11/32] Update aws-sdk-go to adress vulerabilitiy --- go.mod | 2 +- go.sum | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index da117acd3..1222821f5 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ require ( cloud.google.com/go/storage v1.29.0 github.com/Azure/go-autorest/autorest/adal v0.9.16 github.com/ClickHouse/clickhouse-go v1.4.3 - github.com/aws/aws-sdk-go v1.34.0 + github.com/aws/aws-sdk-go v1.44.301 github.com/cenkalti/backoff/v4 v4.1.2 github.com/cockroachdb/cockroach-go/v2 v2.1.1 github.com/dhui/dktest v0.3.16 diff --git a/go.sum b/go.sum index 700aff24e..5cbfb3282 100644 --- a/go.sum +++ b/go.sum @@ -79,6 +79,8 @@ github.com/apache/thrift v0.16.0 h1:qEy6UW60iVOlUy+b9ZR0d5WzUWYGOo4HfopoyBaNmoY= github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU= github.com/aws/aws-sdk-go v1.34.0 h1:brux2dRrlwCF5JhTL7MUT3WUwo9zfDHZZp3+g3Mvlmo= github.com/aws/aws-sdk-go v1.34.0/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= +github.com/aws/aws-sdk-go v1.44.301 h1:VofuXktwHFTBUvoPiHxQis/3uKgu0RtgUwLtNujd3Zs= +github.com/aws/aws-sdk-go v1.44.301/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v1.16.16 h1:M1fj4FE2lB4NzRb9Y0xdWsn2P0+2UHVxwKyOa4YJNjk= github.com/aws/aws-sdk-go-v2 v1.16.16/go.mod h1:SwiyXi/1zTUZ6KIAmLK5V5ll8SiURNUYOqTerZPaF9k= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.8 h1:tcFliCWne+zOuUfKNRn8JdFBuWPDuISDH08wD2ULkhk= @@ -688,6 +690,7 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= @@ -753,12 +756,14 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= @@ -772,6 +777,7 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= From f2e0b335d747c7562e89f320561f956d3f8bac5e Mon Sep 17 00:00:00 2001 From: Rob Prentiss Date: Thu, 20 Jul 2023 15:19:23 -0700 Subject: [PATCH 12/32] Update lib/pq to fix cert permissions issues When attempting to connect to a PostgreSQL database using certificate credentials, authentication may fail due to permissions issues on the certificate files. When using migrate in Kubernetes, this issue may be unavoidable when using secrets. The github.com/lib/pq library has resolved this issue as of v1.10.6, so this commit updates that library to the latest release version (v1.10.9) to resolve the issue in migrate. --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index da117acd3..8eda73a71 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/jackc/pgx/v4 v4.18.1 github.com/jackc/pgx/v5 v5.3.1 github.com/ktrysmt/go-bitbucket v0.6.4 - github.com/lib/pq v1.10.2 + github.com/lib/pq v1.10.9 github.com/markbates/pkger v0.15.1 github.com/mattn/go-sqlite3 v1.14.16 github.com/microsoft/go-mssqldb v1.0.0 diff --git a/go.sum b/go.sum index 700aff24e..e032d29a3 100644 --- a/go.sum +++ b/go.sum @@ -444,8 +444,9 @@ github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/markbates/pkger v0.15.1 h1:3MPelV53RnGSW07izx5xGxl4e/sdRD6zqseIk0rMASY= github.com/markbates/pkger v0.15.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= From 129922aae306ce181df73bfd7061725cba4ae23b Mon Sep 17 00:00:00 2001 From: Andreas Emilsson Date: Wed, 20 Sep 2023 09:59:55 +0200 Subject: [PATCH 13/32] Added support for pgx locking table In order to support running migrations through PgBouncer which does not support advisory locks. --- database/pgx/pgx.go | 158 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 139 insertions(+), 19 deletions(-) diff --git a/database/pgx/pgx.go b/database/pgx/pgx.go index deaca94ea..9e7d36d9e 100644 --- a/database/pgx/pgx.go +++ b/database/pgx/pgx.go @@ -25,6 +25,11 @@ import ( _ "github.com/jackc/pgx/v4/stdlib" ) +const ( + LockStrategyAdvisory = "advisory" + LockStrategyTable = "table" +) + func init() { db := Postgres{} database.Register("pgx", &db) @@ -36,6 +41,8 @@ var ( DefaultMigrationsTable = "schema_migrations" DefaultMultiStatementMaxSize = 10 * 1 << 20 // 10 MB + DefaultLockTable = "schema_lock" + DefaultLockStrategy = "advisory" ) var ( @@ -49,6 +56,8 @@ type Config struct { MigrationsTable string DatabaseName string SchemaName string + LockTable string + LockStrategy string migrationsSchemaName string migrationsTableName string StatementTimeout time.Duration @@ -108,6 +117,14 @@ func WithInstance(instance *sql.DB, config *Config) (database.Driver, error) { config.MigrationsTable = DefaultMigrationsTable } + if len(config.LockTable) == 0 { + config.LockTable = DefaultLockTable + } + + if len(config.LockStrategy) == 0 { + config.LockStrategy = DefaultLockStrategy + } + config.migrationsSchemaName = config.SchemaName config.migrationsTableName = config.MigrationsTable if config.MigrationsTableQuoted { @@ -133,6 +150,10 @@ func WithInstance(instance *sql.DB, config *Config) (database.Driver, error) { config: config, } + if err := px.ensureLockTable(); err != nil { + return nil, err + } + if err := px.ensureVersionTable(); err != nil { return nil, err } @@ -196,6 +217,8 @@ func (p *Postgres) Open(url string) (database.Driver, error) { } } + lockStrategy := purl.Query().Get("x-lock-strategy") + px, err := WithInstance(db, &Config{ DatabaseName: purl.Path, MigrationsTable: migrationsTable, @@ -203,6 +226,7 @@ func (p *Postgres) Open(url string) (database.Driver, error) { StatementTimeout: time.Duration(statementTimeout) * time.Millisecond, MultiStatementEnabled: multiStatementEnabled, MultiStatementMaxSize: multiStatementMaxSize, + LockStrategy: lockStrategy, }) if err != nil { @@ -221,36 +245,110 @@ func (p *Postgres) Close() error { return nil } -// https://www.postgresql.org/docs/9.6/static/explicit-locking.html#ADVISORY-LOCKS func (p *Postgres) Lock() error { return database.CasRestoreOnErr(&p.isLocked, false, true, database.ErrLocked, func() error { - aid, err := database.GenerateAdvisoryLockId(p.config.DatabaseName, p.config.migrationsSchemaName, p.config.migrationsTableName) - if err != nil { - return err - } - - // This will wait indefinitely until the lock can be acquired. - query := `SELECT pg_advisory_lock($1)` - if _, err := p.conn.ExecContext(context.Background(), query, aid); err != nil { - return &database.Error{OrigErr: err, Err: "try lock failed", Query: []byte(query)} + switch p.config.LockStrategy { + case LockStrategyAdvisory: + return p.applyAdvisoryLock() + case LockStrategyTable: + return p.applyTableLock() + default: + return fmt.Errorf("unknown lock strategy \"%s\"", p.config.LockStrategy) } - return nil }) } func (p *Postgres) Unlock() error { return database.CasRestoreOnErr(&p.isLocked, true, false, database.ErrNotLocked, func() error { - aid, err := database.GenerateAdvisoryLockId(p.config.DatabaseName, p.config.migrationsSchemaName, p.config.migrationsTableName) - if err != nil { - return err + switch p.config.LockStrategy { + case LockStrategyAdvisory: + return p.releaseAdvisoryLock() + case LockStrategyTable: + return p.releaseTableLock() + default: + return fmt.Errorf("unknown lock strategy \"%s\"", p.config.LockStrategy) } + }) +} - query := `SELECT pg_advisory_unlock($1)` - if _, err := p.conn.ExecContext(context.Background(), query, aid); err != nil { - return &database.Error{OrigErr: err, Query: []byte(query)} +// https://www.postgresql.org/docs/9.6/static/explicit-locking.html#ADVISORY-LOCKS +func (p *Postgres) applyAdvisoryLock() error { + aid, err := database.GenerateAdvisoryLockId(p.config.DatabaseName, p.config.migrationsSchemaName, p.config.migrationsTableName) + if err != nil { + return err + } + + // This will wait indefinitely until the lock can be acquired. + query := `SELECT pg_advisory_lock($1)` + if _, err := p.conn.ExecContext(context.Background(), query, aid); err != nil { + return &database.Error{OrigErr: err, Err: "try lock failed", Query: []byte(query)} + } + return nil +} + +func (p *Postgres) applyTableLock() error { + tx, err := p.conn.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return &database.Error{OrigErr: err, Err: "transaction start failed"} + } + + aid, err := database.GenerateAdvisoryLockId(p.config.DatabaseName) + if err != nil { + return err + } + + query := "SELECT * FROM " + p.config.LockTable + " WHERE lock_id = $1" + rows, err := tx.Query(query, aid) + if err != nil { + return database.Error{OrigErr: err, Err: "failed to fetch migration lock", Query: []byte(query)} + } + + defer func() { + if errClose := rows.Close(); errClose != nil { + err = multierror.Append(err, errClose) } - return nil - }) + }() + + // If row exists at all, lock is present + locked := rows.Next() + if locked { + return database.ErrLocked + } + + query = "INSERT INTO " + p.config.LockTable + " (lock_id) VALUES ($1)" + if _, err := tx.Exec(query, aid); err != nil { + return database.Error{OrigErr: err, Err: "failed to set migration lock", Query: []byte(query)} + } + + return tx.Commit() +} + +func (p *Postgres) releaseAdvisoryLock() error { + aid, err := database.GenerateAdvisoryLockId(p.config.DatabaseName, p.config.migrationsSchemaName, p.config.migrationsTableName) + if err != nil { + return err + } + + query := `SELECT pg_advisory_unlock($1)` + if _, err := p.conn.ExecContext(context.Background(), query, aid); err != nil { + return &database.Error{OrigErr: err, Query: []byte(query)} + } + + return nil +} + +func (p *Postgres) releaseTableLock() error { + aid, err := database.GenerateAdvisoryLockId(p.config.DatabaseName) + if err != nil { + return err + } + + query := "DELETE FROM " + p.config.LockTable + " WHERE lock_id = $1" + if _, err := p.db.Exec(query, aid); err != nil { + return database.Error{OrigErr: err, Err: "failed to release migration lock", Query: []byte(query)} + } + + return nil } func (p *Postgres) Run(migration io.Reader) error { @@ -478,6 +576,28 @@ func (p *Postgres) ensureVersionTable() (err error) { return nil } +func (p *Postgres) ensureLockTable() error { + if p.config.LockStrategy != LockStrategyTable { + return nil + } + + var count int + query := `SELECT COUNT(1) FROM information_schema.tables WHERE table_name = $1 AND table_schema = (SELECT current_schema()) LIMIT 1` + if err := p.db.QueryRow(query, p.config.LockTable).Scan(&count); err != nil { + return &database.Error{OrigErr: err, Query: []byte(query)} + } + if count == 1 { + return nil + } + + query = `CREATE TABLE "` + p.config.LockTable + `" (lock_id BIGINT NOT NULL PRIMARY KEY)` + if _, err := p.db.Exec(query); err != nil { + return &database.Error{OrigErr: err, Query: []byte(query)} + } + + return nil +} + // Copied from lib/pq implementation: https://github.com/lib/pq/blob/v1.9.0/conn.go#L1611 func quoteIdentifier(name string) string { end := strings.IndexRune(name, 0) From bead4a952b892495f44c8df81adf010988929a01 Mon Sep 17 00:00:00 2001 From: Tommy Karlsson Date: Wed, 20 Sep 2023 14:27:26 +0200 Subject: [PATCH 14/32] Added documentation and test for lock strategy --- database/pgx/README.md | 2 ++ database/pgx/pgx.go | 8 ++++++++ database/pgx/pgx_test.go | 26 ++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/database/pgx/README.md b/database/pgx/README.md index bad669315..bec7c5c75 100644 --- a/database/pgx/README.md +++ b/database/pgx/README.md @@ -11,6 +11,8 @@ This package is for [pgx/v4](https://pkg.go.dev/github.com/jackc/pgx/v4). A back | `x-statement-timeout` | `StatementTimeout` | Abort any statement that takes more than the specified number of milliseconds | | `x-multi-statement` | `MultiStatementEnabled` | Enable multi-statement execution (default: false) | | `x-multi-statement-max-size` | `MultiStatementMaxSize` | Maximum size of single statement in bytes (default: 10MB) | +| `x-lock-strategy` | `LockStrategy` | Strategy used for locking during migration (default: advisory) | +| `x-lock-table` | `LockTable` | Name of the table which maintains the migration lock (default: schema_lock) | | `dbname` | `DatabaseName` | The name of the database to connect to | | `search_path` | | This variable specifies the order in which schemas are searched when an object is referenced by a simple name with no schema specified. | | `user` | | The user to sign in as | diff --git a/database/pgx/pgx.go b/database/pgx/pgx.go index 9e7d36d9e..849785e38 100644 --- a/database/pgx/pgx.go +++ b/database/pgx/pgx.go @@ -218,6 +218,7 @@ func (p *Postgres) Open(url string) (database.Driver, error) { } lockStrategy := purl.Query().Get("x-lock-strategy") + lockTable := purl.Query().Get("x-lock-table") px, err := WithInstance(db, &Config{ DatabaseName: purl.Path, @@ -227,6 +228,7 @@ func (p *Postgres) Open(url string) (database.Driver, error) { MultiStatementEnabled: multiStatementEnabled, MultiStatementMaxSize: multiStatementMaxSize, LockStrategy: lockStrategy, + LockTable: lockTable, }) if err != nil { @@ -512,6 +514,12 @@ func (p *Postgres) Drop() (err error) { if err := tables.Scan(&tableName); err != nil { return err } + + // do not drop lock table + if tableName == p.config.LockTable && p.config.LockStrategy == LockStrategyTable { + continue + } + if len(tableName) > 0 { tableNames = append(tableNames, tableName) } diff --git a/database/pgx/pgx_test.go b/database/pgx/pgx_test.go index 5d7a5238e..53e8e1d86 100644 --- a/database/pgx/pgx_test.go +++ b/database/pgx/pgx_test.go @@ -134,6 +134,32 @@ func TestMigrate(t *testing.T) { }) } +func TestMigrateLockTable(t *testing.T) { + dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) { + ip, port, err := c.FirstPort() + if err != nil { + t.Fatal(err) + } + + addr := pgConnectionString(ip, port, "x-lock-strategy=table", "x-lock-table=lock_table") + p := &Postgres{} + d, err := p.Open(addr) + if err != nil { + t.Fatal(err) + } + defer func() { + if err := d.Close(); err != nil { + t.Error(err) + } + }() + m, err := migrate.NewWithDatabaseInstance("file://./examples/migrations", "pgx", d) + if err != nil { + t.Fatal(err) + } + dt.TestMigrate(t, m) + }) +} + func TestMultipleStatements(t *testing.T) { dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) { ip, port, err := c.FirstPort() From 12968a75af13d417673825acd5aaf20f6a299485 Mon Sep 17 00:00:00 2001 From: Toby Scott Date: Sat, 4 Nov 2023 12:24:32 +1100 Subject: [PATCH 15/32] Add syntax highlighting to Postgres example --- database/postgres/TUTORIAL.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/database/postgres/TUTORIAL.md b/database/postgres/TUTORIAL.md index 0f19c56ff..6ab98906a 100644 --- a/database/postgres/TUTORIAL.md +++ b/database/postgres/TUTORIAL.md @@ -27,7 +27,7 @@ If there were no errors, we should have two files available under `db/migrations Note the `sql` extension that we provided. In the `.up.sql` file let's create the table: -``` +```sql CREATE TABLE IF NOT EXISTS users( user_id serial PRIMARY KEY, username VARCHAR (50) UNIQUE NOT NULL, @@ -36,7 +36,7 @@ CREATE TABLE IF NOT EXISTS users( ); ``` And in the `.down.sql` let's delete it: -``` +```sql DROP TABLE IF EXISTS users; ``` By adding `IF EXISTS/IF NOT EXISTS` we are making migrations idempotent - you can read more about idempotency in [getting started](../../GETTING_STARTED.md#create-migrations) @@ -79,7 +79,7 @@ Again, it should create for us two migrations files: In Postgres, when we want our queries to be done in a transaction, we need to wrap it with `BEGIN` and `COMMIT` commands. In our example, we are going to add a column to our database that can only accept enumerable values or NULL. Migration up: -``` +```sql BEGIN; CREATE TYPE enum_mood AS ENUM ( @@ -92,7 +92,7 @@ ALTER TABLE users ADD COLUMN mood enum_mood; COMMIT; ``` Migration down: -``` +```sql BEGIN; ALTER TABLE users DROP COLUMN mood; @@ -124,7 +124,7 @@ Indexes: ## Optional: Run migrations within your Go app Here is a very simple app running migrations for the above configuration: -``` +```go import ( "log" From 72957b69664705f9f49ca7c0a43e16f02417c5c6 Mon Sep 17 00:00:00 2001 From: Jacopo Sabbatini Date: Tue, 14 Nov 2023 15:04:55 +1100 Subject: [PATCH 16/32] Updated version of spanner to support sequences and generate uuid --- go.mod | 65 +++++++++++++++++++++++++++++----------------------------- go.sum | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 32 deletions(-) diff --git a/go.mod b/go.mod index da117acd3..bc91c7af0 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/golang-migrate/migrate/v4 require ( - cloud.google.com/go/spanner v1.47.0 - cloud.google.com/go/storage v1.29.0 + cloud.google.com/go/spanner v1.51.0 + cloud.google.com/go/storage v1.30.1 github.com/Azure/go-autorest/autorest/adal v0.9.16 github.com/ClickHouse/clickhouse-go v1.4.3 github.com/aws/aws-sdk-go v1.34.0 @@ -30,23 +30,23 @@ require ( github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8 github.com/neo4j/neo4j-go-driver v1.8.1-0.20200803113522-b626aa943eba github.com/snowflakedb/gosnowflake v1.6.19 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.3 github.com/xanzy/go-gitlab v0.15.0 go.mongodb.org/mongo-driver v1.7.5 go.uber.org/atomic v1.7.0 - golang.org/x/oauth2 v0.8.0 - golang.org/x/tools v0.9.1 - google.golang.org/api v0.126.0 + golang.org/x/oauth2 v0.14.0 + golang.org/x/tools v0.10.0 + google.golang.org/api v0.150.0 modernc.org/ql v1.0.0 modernc.org/sqlite v1.18.1 ) require ( - cloud.google.com/go v0.110.2 // indirect - cloud.google.com/go/compute v1.19.3 // indirect + cloud.google.com/go v0.110.10 // indirect + cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.0 // indirect - cloud.google.com/go/longrunning v0.5.0 // indirect + cloud.google.com/go/iam v1.1.5 // indirect + cloud.google.com/go/longrunning v0.5.4 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 // indirect @@ -78,7 +78,7 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 // indirect github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe // indirect - github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195 // indirect + github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101 // indirect github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -86,8 +86,8 @@ require ( github.com/docker/go-units v0.5.0 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 // indirect - github.com/envoyproxy/go-control-plane v0.11.0 // indirect - github.com/envoyproxy/protoc-gen-validate v0.10.0 // indirect + github.com/envoyproxy/go-control-plane v0.11.1 // indirect + github.com/envoyproxy/protoc-gen-validate v1.0.2 // indirect github.com/form3tech-oss/jwt-go v3.2.5+incompatible // indirect github.com/gabriel-vasile/mimetype v1.4.1 // indirect github.com/go-stack/stack v1.8.0 // indirect @@ -101,12 +101,12 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/flatbuffers v2.0.8+incompatible // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/go-querystring v1.1.0 // indirect - github.com/google/s2a-go v0.1.4 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect - github.com/googleapis/gax-go/v2 v2.11.0 // indirect + github.com/google/s2a-go v0.1.7 // indirect + github.com/google/uuid v1.4.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gorilla/handlers v1.4.2 // indirect github.com/gorilla/mux v1.7.4 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect @@ -151,21 +151,22 @@ require ( github.com/zeebo/xxh3 v1.0.2 // indirect gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.9.0 // indirect + golang.org/x/crypto v0.15.0 // indirect golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect - golang.org/x/mod v0.10.0 // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/term v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect - golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.55.0 // indirect - google.golang.org/protobuf v1.30.0 // indirect + golang.org/x/mod v0.11.0 // indirect + golang.org/x/net v0.18.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.14.0 // indirect + golang.org/x/term v0.14.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.4.0 // indirect + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect + google.golang.org/grpc v1.59.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/uint128 v1.2.0 // indirect diff --git a/go.sum b/go.sum index 700aff24e..dfd3369e9 100644 --- a/go.sum +++ b/go.sum @@ -8,25 +8,36 @@ cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= cloud.google.com/go v0.110.2 h1:sdFPBr6xG9/wkBbfhmUz/JmZC7X6LavQgcrVINrKiVA= cloud.google.com/go v0.110.2/go.mod h1:k04UEeEtb6ZBRTv3dZz4CeJC3jKGxyhl0sAiVVquxiw= +cloud.google.com/go v0.110.10 h1:LXy9GEO+timppncPIAZoOj3l58LIU9k+kn48AN7IO3Y= +cloud.google.com/go v0.110.10/go.mod h1:v1OoFqYxiBkUrruItNM3eT4lLByNjxmJSV/xDKJNnic= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/compute v1.19.3 h1:DcTwsFgGev/wV5+q8o2fzgcHOaac+DKGC91ZlvpsQds= cloud.google.com/go/compute v1.19.3/go.mod h1:qxvISKp/gYnXkSAD1ppcSOveRAmzxicEv/JlizULFrI= +cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= +cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/iam v1.1.0 h1:67gSqaPukx7O8WLLHMa0PNs3EBGd2eE4d+psbO/CO94= cloud.google.com/go/iam v1.1.0/go.mod h1:nxdHjaKfCr7fNYx/HJMM8LgiMugmveWlkatear5gVyk= +cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= +cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= cloud.google.com/go/longrunning v0.5.0 h1:DK8BH0+hS+DIvc9a2TPnteUievsTCH4ORMAASSb7JcQ= cloud.google.com/go/longrunning v0.5.0/go.mod h1:0JNuqRShmscVAhIACGtskSAWtqtOoPkwP0YF1oVEchc= +cloud.google.com/go/longrunning v0.5.4 h1:w8xEcbZodnA2BbW6sVirkkoC+1gP8wS57EUUgGS0GVg= +cloud.google.com/go/longrunning v0.5.4/go.mod h1:zqNVncI0BOP8ST6XQD1+VcvuShMmq7+xFSzOL++V0dI= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/spanner v1.47.0 h1:aqiMP8dhsEXgn9K5EZBWxPG7dxIiyM2VaikqeU4iteg= cloud.google.com/go/spanner v1.47.0/go.mod h1:IXsJwVW2j4UKs0eYDqodab6HgGuA1bViSqW4uH9lfUI= +cloud.google.com/go/spanner v1.51.0 h1:l3exhhsVMKsx1E7Xd1QajYSvHmI1KZoWPW5tRxIIdvQ= +cloud.google.com/go/spanner v1.51.0/go.mod h1:c5KNo5LQ1X5tJwma9rSQZsXNBDNvj4/n8BVc3LNahq0= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.29.0 h1:6weCgzRvMg7lzuUurI4697AqIRPU1SvzHhynwpW31jI= cloud.google.com/go/storage v1.29.0/go.mod h1:4puEjyTKnku6gfKoTfNOU/W+a9JyuVNxjpS5GBrB8h4= +cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= @@ -144,6 +155,8 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195 h1:58f1tJ1ra+zFINPlwLWvQsR9CzAKt2e+EWV2yX9oXQ4= github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101 h1:7To3pQ+pZo0i3dsWEbinPNFs5gPSBOsJtx3wTT94VBY= +github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/cockroach-go/v2 v2.1.1 h1:3XzfSMuUT0wBe1a3o5C0eOTcArhmmFAg2Jzh/7hhKqo= @@ -188,9 +201,13 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.11.0 h1:jtLewhRR2vMRNnq2ZZUoCjUlgut+Y0+sDDWPOfwOi1o= github.com/envoyproxy/go-control-plane v0.11.0/go.mod h1:VnHyVMpzcLvCFt9yUz1UnCwHLhwx1WguiVDV7pTG/tI= +github.com/envoyproxy/go-control-plane v0.11.1 h1:wSUXTlLfiAQRWs2F+p+EKOY9rUyis1MyGqJ2DIk5HpM= +github.com/envoyproxy/go-control-plane v0.11.1/go.mod h1:uhMcXKCQMEJHiAb0w+YGefQLaTEw+YhGluxZkrTmD0g= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.10.0 h1:oIfnZFdC0YhpNNEX+SuIqko4cqqVZeN9IGTrhZje83Y= github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= +github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= +github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= github.com/form3tech-oss/jwt-go v3.2.5+incompatible h1:/l4kBbb4/vGSsdtB5nUe8L7B9mImVMaBPw9L/0TBHU8= github.com/form3tech-oss/jwt-go v3.2.5+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -279,6 +296,8 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v39 v39.2.0 h1:rNNM311XtPOz5rDdsJXAp2o8F67X9FnROXTvto3aSnQ= github.com/google/go-github/v39 v39.2.0/go.mod h1:C1s8C5aCC9L+JXIYpJM5GYytdX52vC1bLvHEF1IhBrE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= @@ -292,16 +311,24 @@ github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OI github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= +github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= +github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= +github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= @@ -560,6 +587,7 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/xanzy/go-gitlab v0.15.0 h1:rWtwKTgEnXyNUGrOArN7yyc3THRkpYcKXIXia9abywQ= @@ -628,6 +656,8 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= +golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -657,6 +687,7 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -692,6 +723,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= +golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -701,6 +734,8 @@ golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/oauth2 v0.14.0 h1:P0Vrf/2538nmC0H+pEQ3MNFRRnVR7RlqyVw+bvm26z0= +golang.org/x/oauth2 v0.14.0/go.mod h1:lAtNWgaWfL4cm7j2OV8TxGi9Qb7ECORx8DktCY74OwM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -711,6 +746,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -756,12 +793,16 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.14.0 h1:LGK9IlZ8T9jvdy6cTdfKUCltatMFOehAQo9SRC46UQ8= +golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -775,10 +816,14 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 h1:M73Iuj3xbbb9Uk1DYhzydthsj6oOd6l9bpuFcNoUvTs= golang.org/x/time v0.0.0-20220224211638-0e9765cccd65/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.4.0 h1:Z81tqI5ddIoXDPvVQ7/7CC9TnLM7ubaFG2qXYd5BbYY= +golang.org/x/time v0.4.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -815,6 +860,8 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg= +golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -823,6 +870,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= gonum.org/v1/gonum v0.11.0 h1:f1IJhK4Km5tBJmaiJXtk/PkL4cdVX6J+tGiM187uT5E= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -833,6 +882,8 @@ google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsb google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.126.0 h1:q4GJq+cAdMAC7XP7njvQ4tvohGLiSlytuL4BQxbIZ+o= google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= +google.golang.org/api v0.150.0 h1:Z9k22qD289SZ8gCJrk4DrWXkNjtfvKAUo/l1ma8eBYE= +google.golang.org/api v0.150.0/go.mod h1:ccy+MJ6nrYFgE3WgRx/AMXOxOmU8Q4hSa+jjibzhxcg= google.golang.org/appengine v1.0.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -842,6 +893,8 @@ google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -858,10 +911,16 @@ google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc h1:8DyZCyvI8mE1IdLy/60bS+52xfymkE72wv1asokgtao= google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= +google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= +google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy1+IPwWHZUzoD0IccYZIrXILAQpc+Qy9CMhY= google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 h1:JpwMPBpFN3uKhdaekDpiNlImDdkUAyiJ6ez/uxGaUSo= +google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -875,6 +934,8 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -888,6 +949,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From ee8a8e50a7e29ef7f5ebb1efb9ef6a80d27a1cc4 Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Mon, 27 Nov 2023 13:45:49 +0800 Subject: [PATCH 17/32] fix: typo Signed-off-by: guoguangwu --- FAQ.md | 2 +- GETTING_STARTED.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FAQ.md b/FAQ.md index 283162819..b4261ee8e 100644 --- a/FAQ.md +++ b/FAQ.md @@ -50,7 +50,7 @@ and whenever we want, not just once at the beginning of all tests. #### Can I maintain my driver in my own repository? - Yes, technically thats possible. We want to encourage you to contribute your driver to this respository though. + Yes, technically thats possible. We want to encourage you to contribute your driver to this repository though. The driver's functionality is dictated by migrate's interfaces. That means there should really just be one driver for a database/ source. We want to prevent a future where several drivers doing the exact same thing, just implemented a bit differently, co-exist somewhere on GitHub. If users have to do research first to find the diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index 5a204c07e..45e9a4e41 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -28,7 +28,7 @@ migrate -database YOUR_DATABASE_URL -path PATH_TO_YOUR_MIGRATIONS up Just add the code to your app and you're ready to go! -Before commiting your migrations you should run your migrations up, down, and then up again to see if migrations are working properly both ways. +Before committing your migrations you should run your migrations up, down, and then up again to see if migrations are working properly both ways. (e.g. if you created a table in a migration but reverse migration did not delete it, you will encounter an error when running the forward migration again) It's also worth checking your migrations in a separate, containerized environment. You can find some tools at the [end of this document](#further-reading). From 5163ac782428cddbc7feba4a19fe94f9ae925699 Mon Sep 17 00:00:00 2001 From: Erik Swenson Date: Sun, 5 Nov 2023 14:48:39 -0700 Subject: [PATCH 18/32] feature: add rqlite support --- Makefile | 2 +- README.md | 1 + database/rqlite/README.md | 18 + .../migrations/33_create_table.down.sql | 1 + .../migrations/33_create_table.up.sql | 3 + .../migrations/44_alter_table.down.sql | 1 + .../examples/migrations/44_alter_table.up.sql | 1 + database/rqlite/rqlite.go | 334 ++++++++++++++++++ database/rqlite/rqlite_test.go | 322 +++++++++++++++++ go.mod | 1 + go.sum | 2 + internal/cli/build_rqlite.go | 8 + 12 files changed, 693 insertions(+), 1 deletion(-) create mode 100644 database/rqlite/README.md create mode 100644 database/rqlite/examples/migrations/33_create_table.down.sql create mode 100644 database/rqlite/examples/migrations/33_create_table.up.sql create mode 100644 database/rqlite/examples/migrations/44_alter_table.down.sql create mode 100644 database/rqlite/examples/migrations/44_alter_table.up.sql create mode 100644 database/rqlite/rqlite.go create mode 100644 database/rqlite/rqlite_test.go create mode 100644 internal/cli/build_rqlite.go diff --git a/Makefile b/Makefile index 61e035c0e..8e23a43c7 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ SOURCE ?= file go_bindata github github_ee bitbucket aws_s3 google_cloud_storage godoc_vfs gitlab -DATABASE ?= postgres mysql redshift cassandra spanner cockroachdb yugabytedb clickhouse mongodb sqlserver firebird neo4j pgx pgx5 +DATABASE ?= postgres mysql redshift cassandra spanner cockroachdb yugabytedb clickhouse mongodb sqlserver firebird neo4j pgx pgx5 rqlite DATABASE_TEST ?= $(DATABASE) sqlite sqlite3 sqlcipher VERSION ?= $(shell git describe --tags 2>/dev/null | cut -c 2-) TEST_FLAGS ?= diff --git a/README.md b/README.md index c26999424..9243da5a7 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ Database drivers run migrations. [Add a new database?](database/driver.go) * [ClickHouse](database/clickhouse) * [Firebird](database/firebird) * [MS SQL Server](database/sqlserver) +* [RQLite](database/rqlite) ### Database URLs diff --git a/database/rqlite/README.md b/database/rqlite/README.md new file mode 100644 index 000000000..386c72705 --- /dev/null +++ b/database/rqlite/README.md @@ -0,0 +1,18 @@ +# rqlite + +`rqlite://admin:secret@server1.example.com:4001/?level=strong&timeout=5` + +The `rqlite` url scheme is used for both secure and insecure connections. If connecting to an insecure database, pass `x-connect-insecure` in your URL query, or use `WithInstance` to pass an established connection. + +The migrations table name is configurable through the `x-migrations-table` URL query parameter, or by using `WithInstance` and passing `MigrationsTable` through `Config`. + +Other connect parameters are directly passed through to the database driver. For examples of connection strings, see https://github.com/rqlite/gorqlite#examples. + +| URL Query | WithInstance Config | Description | +|------------|---------------------|-------------| +| `x-connect-insecure` | n/a: set on instance | Boolean to indicate whether to use an insecure connection. Defaults to `false`. | +| `x-migrations-table` | `MigrationsTable` | Name of the migrations table. Defaults to `schema_migrations`. | + +## Notes + +* Uses the https://github.com/rqlite/gorqlite driver diff --git a/database/rqlite/examples/migrations/33_create_table.down.sql b/database/rqlite/examples/migrations/33_create_table.down.sql new file mode 100644 index 000000000..72d18c554 --- /dev/null +++ b/database/rqlite/examples/migrations/33_create_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS pets; \ No newline at end of file diff --git a/database/rqlite/examples/migrations/33_create_table.up.sql b/database/rqlite/examples/migrations/33_create_table.up.sql new file mode 100644 index 000000000..5ad3404d1 --- /dev/null +++ b/database/rqlite/examples/migrations/33_create_table.up.sql @@ -0,0 +1,3 @@ +CREATE TABLE pets ( + name string +); \ No newline at end of file diff --git a/database/rqlite/examples/migrations/44_alter_table.down.sql b/database/rqlite/examples/migrations/44_alter_table.down.sql new file mode 100644 index 000000000..72d18c554 --- /dev/null +++ b/database/rqlite/examples/migrations/44_alter_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS pets; \ No newline at end of file diff --git a/database/rqlite/examples/migrations/44_alter_table.up.sql b/database/rqlite/examples/migrations/44_alter_table.up.sql new file mode 100644 index 000000000..f0682fcca --- /dev/null +++ b/database/rqlite/examples/migrations/44_alter_table.up.sql @@ -0,0 +1 @@ +ALTER TABLE pets ADD predator bool; diff --git a/database/rqlite/rqlite.go b/database/rqlite/rqlite.go new file mode 100644 index 000000000..14d3bd340 --- /dev/null +++ b/database/rqlite/rqlite.go @@ -0,0 +1,334 @@ +package rqlite + +import ( + "fmt" + "io" + nurl "net/url" + "strconv" + "strings" + + "go.uber.org/atomic" + + "github.com/golang-migrate/migrate/v4" + "github.com/golang-migrate/migrate/v4/database" + "github.com/hashicorp/go-multierror" + "github.com/pkg/errors" + "github.com/rqlite/gorqlite" +) + +func init() { + database.Register("rqlite", &Rqlite{}) +} + +const ( + // DefaultMigrationsTable defines the default rqlite migrations table + DefaultMigrationsTable = "schema_migrations" + + // DefaultConnectInsecure defines the default setting for connect insecure + DefaultConnectInsecure = false +) + +// ErrNilConfig is returned if no configuration was passed to WithInstance +var ErrNilConfig = fmt.Errorf("no config") + +// ErrBadConfig is returned if configuration was invalid +var ErrBadConfig = fmt.Errorf("bad parameter") + +// Config defines the driver configuration +type Config struct { + // ConnectInsecure sets whether the connection uses TLS. Ineffectual when using WithInstance + ConnectInsecure bool + // MigrationsTable configures the migrations table name + MigrationsTable string +} + +type Rqlite struct { + db *gorqlite.Connection + isLocked atomic.Bool + + config *Config +} + +// WithInstance creates a rqlite database driver with an existing gorqlite database connection +// and a Config struct +func WithInstance(instance *gorqlite.Connection, config *Config) (database.Driver, error) { + if config == nil { + return nil, ErrNilConfig + } + + // we use the consistency level check as a database ping + if _, err := instance.ConsistencyLevel(); err != nil { + return nil, err + } + + if len(config.MigrationsTable) == 0 { + config.MigrationsTable = DefaultMigrationsTable + } + + driver := &Rqlite{ + db: instance, + config: config, + } + + if err := driver.ensureVersionTable(); err != nil { + return nil, err + } + + return driver, nil +} + +// OpenURL creates a rqlite database driver from a connect URL +func OpenURL(url string) (database.Driver, error) { + d := &Rqlite{} + return d.Open(url) +} + +func (r *Rqlite) ensureVersionTable() (err error) { + if err = r.Lock(); err != nil { + return err + } + + defer func() { + if e := r.Unlock(); e != nil { + if err == nil { + err = e + } else { + err = multierror.Append(err, e) + } + } + }() + + stmts := []string{ + fmt.Sprintf(`CREATE TABLE IF NOT EXISTS %s (version uint64, dirty bool)`, r.config.MigrationsTable), + fmt.Sprintf(`CREATE UNIQUE INDEX IF NOT EXISTS version_unique ON %s (version)`, r.config.MigrationsTable), + } + + if _, err := r.db.Write(stmts); err != nil { + return err + } + + return nil +} + +// Open returns a new driver instance configured with parameters +// coming from the URL string. Migrate will call this function +// only once per instance. +func (r *Rqlite) Open(url string) (database.Driver, error) { + dburl, config, err := parseUrl(url) + if err != nil { + return nil, err + } + r.config = config + + r.db, err = gorqlite.Open(dburl.String()) + if err != nil { + return nil, err + } + + if err := r.ensureVersionTable(); err != nil { + return nil, err + } + + return r, nil +} + +// Close closes the underlying database instance managed by the driver. +// Migrate will call this function only once per instance. +func (r *Rqlite) Close() error { + r.db.Close() + return nil +} + +// Lock should acquire a database lock so that only one migration process +// can run at a time. Migrate will call this function before Run is called. +// If the implementation can't provide this functionality, return nil. +// Return database.ErrLocked if database is already locked. +func (r *Rqlite) Lock() error { + if !r.isLocked.CAS(false, true) { + return database.ErrLocked + } + return nil +} + +// Unlock should release the lock. Migrate will call this function after +// all migrations have been run. +func (r *Rqlite) Unlock() error { + if !r.isLocked.CAS(true, false) { + return database.ErrNotLocked + } + return nil +} + +// Run applies a migration to the database. migration is guaranteed to be not nil. +func (r *Rqlite) Run(migration io.Reader) error { + migr, err := io.ReadAll(migration) + if err != nil { + return err + } + + query := string(migr[:]) + if _, err := r.db.WriteOne(query); err != nil { + return &database.Error{OrigErr: err, Query: []byte(query)} + } + + return nil +} + +// SetVersion saves version and dirty state. +// Migrate will call this function before and after each call to Run. +// version must be >= -1. -1 means NilVersion. +func (r *Rqlite) SetVersion(version int, dirty bool) error { + deleteQuery := fmt.Sprintf(`DELETE FROM %s`, r.config.MigrationsTable) + statements := []gorqlite.ParameterizedStatement{ + { + Query: deleteQuery, + }, + } + + // Also re-write the schema version for nil dirty versions to prevent + // empty schema version for failed down migration on the first migration + // See: https://github.com/golang-migrate/migrate/issues/330 + insertQuery := fmt.Sprintf(`INSERT INTO %s (version, dirty) VALUES (?, ?)`, r.config.MigrationsTable) + if version >= 0 || (version == database.NilVersion && dirty) { + statements = append(statements, gorqlite.ParameterizedStatement{ + Query: insertQuery, + Arguments: []interface{}{ + version, + dirty, + }, + }) + } + + wr, err := r.db.WriteParameterized(statements) + if err != nil { + for i, res := range wr { + if res.Err != nil { + return &database.Error{OrigErr: err, Query: []byte(statements[i].Query)} + } + } + + // if somehow we're still here, return the original error with combined queries + return &database.Error{OrigErr: err, Query: []byte(deleteQuery + "\n" + insertQuery)} + } + + return nil +} + +// Version returns the currently active version and if the database is dirty. +// When no migration has been applied, it must return version -1. +// Dirty means, a previous migration failed and user interaction is required. +func (r *Rqlite) Version() (version int, dirty bool, err error) { + query := "SELECT version, dirty FROM " + r.config.MigrationsTable + " LIMIT 1" + + qr, err := r.db.QueryOne(query) + if err != nil { + return database.NilVersion, false, nil + } + + if !qr.Next() { + return database.NilVersion, false, nil + } + + if err := qr.Scan(&version, &dirty); err != nil { + return database.NilVersion, false, &database.Error{OrigErr: err, Query: []byte(query)} + } + + return version, dirty, nil +} + +// Drop deletes everything in the database. +// Note that this is a breaking action, a new call to Open() is necessary to +// ensure subsequent calls work as expected. +func (r *Rqlite) Drop() error { + query := `SELECT name FROM sqlite_master WHERE type = 'table'` + + tables, err := r.db.QueryOne(query) + if err != nil { + return &database.Error{OrigErr: err, Query: []byte(query)} + } + + statements := make([]string, 0) + for tables.Next() { + var tableName string + if err := tables.Scan(&tableName); err != nil { + return err + } + + if len(tableName) > 0 { + statement := fmt.Sprintf(`DROP TABLE %s`, tableName) + statements = append(statements, statement) + } + } + + // return if nothing to do + if len(statements) <= 0 { + return nil + } + + wr, err := r.db.Write(statements) + if err != nil { + for i, res := range wr { + if res.Err != nil { + return &database.Error{OrigErr: err, Query: []byte(statements[i])} + } + } + + // if somehow we're still here, return the original error with combined queries + return &database.Error{OrigErr: err, Query: []byte(strings.Join(statements, "\n"))} + } + + return nil +} + +func parseUrl(url string) (*nurl.URL, *Config, error) { + parsedUrl, err := nurl.Parse(url) + if err != nil { + return nil, nil, err + } + + config, err := parseConfigFromQuery(parsedUrl.Query()) + if err != nil { + return nil, nil, err + } + + if parsedUrl.Scheme != "rqlite" { + return nil, nil, errors.Wrap(ErrBadConfig, "bad scheme") + } + + // adapt from rqlite to http/https schemes + if config.ConnectInsecure { + parsedUrl.Scheme = "http" + } else { + parsedUrl.Scheme = "https" + } + + filteredUrl := migrate.FilterCustomQuery(parsedUrl) + + return filteredUrl, config, nil +} + +func parseConfigFromQuery(queryVals nurl.Values) (*Config, error) { + c := Config{ + ConnectInsecure: DefaultConnectInsecure, + MigrationsTable: DefaultMigrationsTable, + } + + migrationsTable := queryVals.Get("x-migrations-table") + if migrationsTable != "" { + if strings.HasPrefix(migrationsTable, "sqlite_") { + return nil, errors.Wrap(ErrBadConfig, "invalid value for x-migrations-table") + } + c.MigrationsTable = migrationsTable + } + + connectInsecureStr := queryVals.Get("x-connect-insecure") + if connectInsecureStr != "" { + connectInsecure, err := strconv.ParseBool(connectInsecureStr) + if err != nil { + return nil, errors.Wrap(ErrBadConfig, "invalid value for x-connect-insecure") + } + c.ConnectInsecure = connectInsecure + } + + return &c, nil +} diff --git a/database/rqlite/rqlite_test.go b/database/rqlite/rqlite_test.go new file mode 100644 index 000000000..9d5c663e5 --- /dev/null +++ b/database/rqlite/rqlite_test.go @@ -0,0 +1,322 @@ +package rqlite + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "testing" + + "github.com/dhui/dktest" + "github.com/rqlite/gorqlite" + "github.com/stretchr/testify/assert" + + "github.com/golang-migrate/migrate/v4" + dt "github.com/golang-migrate/migrate/v4/database/testing" + "github.com/golang-migrate/migrate/v4/dktesting" + _ "github.com/golang-migrate/migrate/v4/source/file" +) + +var defaultPort uint16 = 4001 + +var opts = dktest.Options{ + Env: map[string]string{"NODE_ID": "1"}, + PortRequired: true, + ReadyFunc: isReady, +} +var specs = []dktesting.ContainerSpec{ + {ImageName: "rqlite/rqlite:7.21.3", Options: opts}, +} + +func isReady(ctx context.Context, c dktest.ContainerInfo) bool { + ip, port, err := c.Port(defaultPort) + if err != nil { + fmt.Println("error getting port") + return false + } + + statusString := fmt.Sprintf("http://%s:%s/status", ip, port) + fmt.Println(statusString) + + var readyResp struct { + Store struct { + Ready bool `json:"ready"` + } `json:"store"` + } + + resp, err := http.Get(statusString) + if err != nil { + fmt.Println("error getting status") + return false + } + + if resp.StatusCode != 200 { + fmt.Println("statusCode != 200") + return false + } + + body, err := io.ReadAll(resp.Body) + if err != nil { + fmt.Println("error reading body") + return false + } + + if err := json.Unmarshal(body, &readyResp); err != nil { + fmt.Println("error unmarshaling body") + return false + } + + fmt.Printf("reporting ready status %+v\n", readyResp) + return readyResp.Store.Ready +} + +func Test(t *testing.T) { + dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) { + ip, port, err := c.Port(defaultPort) + assert.NoError(t, err) + + connectString := fmt.Sprintf("rqlite://%s:%s?level=strong&disableClusterDiscovery=true&x-connect-insecure=true", ip, port) + t.Logf("DB connect string : %s\n", connectString) + + r := &Rqlite{} + d, err := r.Open(connectString) + assert.NoError(t, err) + + dt.Test(t, d, []byte("CREATE TABLE t (Qty int, Name string);")) + }) +} + +func TestMigrate(t *testing.T) { + dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) { + ip, port, err := c.Port(defaultPort) + assert.NoError(t, err) + + connectString := fmt.Sprintf("rqlite://%s:%s?level=strong&disableClusterDiscovery=true&x-connect-insecure=true", ip, port) + t.Logf("DB connect string : %s\n", connectString) + + driver, err := OpenURL(connectString) + assert.NoError(t, err) + defer func() { + if err := driver.Close(); err != nil { + return + } + }() + + m, err := migrate.NewWithDatabaseInstance( + "file://./examples/migrations", + "ql", driver) + assert.NoError(t, err) + + dt.TestMigrate(t, m) + }) +} + +func TestBadConnectInsecureParam(t *testing.T) { + dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) { + ip, port, err := c.Port(defaultPort) + assert.NoError(t, err) + + connectString := fmt.Sprintf("rqlite://%s:%s?x-connect-insecure=foo", ip, port) + t.Logf("DB connect string : %s\n", connectString) + + _, err = OpenURL(connectString) + assert.ErrorIs(t, err, ErrBadConfig) + }) +} + +func TestBadProtocol(t *testing.T) { + dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) { + ip, port, err := c.Port(defaultPort) + assert.NoError(t, err) + + connectString := fmt.Sprintf("postgres://%s:%s/database", ip, port) + t.Logf("DB connect string : %s\n", connectString) + + _, err = OpenURL(connectString) + assert.ErrorIs(t, err, ErrBadConfig) + }) +} + +func TestNoConfig(t *testing.T) { + dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) { + ip, port, err := c.Port(defaultPort) + assert.NoError(t, err) + + // gorqlite expects http(s) schemes + connectString := fmt.Sprintf("http://%s:%s?level=strong&disableClusterDiscovery=true", ip, port) + t.Logf("DB connect string : %s\n", connectString) + db, err := gorqlite.Open(connectString) + assert.NoError(t, err) + + _, err = WithInstance(db, nil) + assert.ErrorIs(t, err, ErrNilConfig) + }) +} + +func TestWithInstanceEmptyConfig(t *testing.T) { + dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) { + ip, port, err := c.Port(defaultPort) + assert.NoError(t, err) + + // gorqlite expects http(s) schemes + connectString := fmt.Sprintf("http://%s:%s?level=strong&disableClusterDiscovery=true", ip, port) + t.Logf("DB connect string : %s\n", connectString) + db, err := gorqlite.Open(connectString) + assert.NoError(t, err) + + driver, err := WithInstance(db, &Config{}) + assert.NoError(t, err) + + defer func() { + if err := driver.Close(); err != nil { + t.Fatal(err) + } + }() + + m, err := migrate.NewWithDatabaseInstance( + "file://./examples/migrations", + "ql", driver) + assert.NoError(t, err) + + t.Log("UP") + err = m.Up() + assert.NoError(t, err) + + _, err = db.QueryOne(fmt.Sprintf("SELECT * FROM %s", DefaultMigrationsTable)) + assert.NoError(t, err) + + t.Log("DOWN") + err = m.Down() + assert.NoError(t, err) + }) +} + +func TestMigrationTable(t *testing.T) { + dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) { + ip, port, err := c.Port(defaultPort) + assert.NoError(t, err) + + // gorqlite expects http(s) schemes + connectString := fmt.Sprintf("http://%s:%s?level=strong&disableClusterDiscovery=true", ip, port) + t.Logf("DB connect string : %s\n", connectString) + db, err := gorqlite.Open(connectString) + assert.NoError(t, err) + + config := Config{MigrationsTable: "my_migration_table"} + driver, err := WithInstance(db, &config) + assert.NoError(t, err) + + defer func() { + if err := driver.Close(); err != nil { + t.Fatal(err) + } + }() + + m, err := migrate.NewWithDatabaseInstance( + "file://./examples/migrations", + "ql", driver) + assert.NoError(t, err) + + t.Log("UP") + err = m.Up() + assert.NoError(t, err) + + _, err = db.QueryOne(fmt.Sprintf("SELECT * FROM %s", config.MigrationsTable)) + assert.NoError(t, err) + + _, err = db.WriteOne(`INSERT INTO pets (name, predator) VALUES ("franklin", true)`) + assert.NoError(t, err) + + res, err := db.QueryOne(`SELECT name, predator FROM pets LIMIT 1`) + assert.NoError(t, err) + + _ = res.Next() + + // make sure we can use the migrated table + var petName string + var petPredator int + err = res.Scan(&petName, &petPredator) + assert.NoError(t, err) + assert.Equal(t, petName, "franklin") + assert.Equal(t, petPredator, 1) + + t.Log("DOWN") + err = m.Down() + assert.NoError(t, err) + + _, err = db.QueryOne(fmt.Sprintf("SELECT * FROM %s", config.MigrationsTable)) + assert.NoError(t, err) + }) +} + +func TestParseUrl(t *testing.T) { + tests := []struct { + name string + passedUrl string + expectedUrl string + expectedConfig *Config + expectedErr string + }{ + { + "defaults", + "rqlite://localhost:4001", + "https://localhost:4001", + &Config{ConnectInsecure: DefaultConnectInsecure, MigrationsTable: DefaultMigrationsTable}, + "", + }, + { + "configure migration table", + "rqlite://localhost:4001?x-migrations-table=foo", + "https://localhost:4001", + &Config{ConnectInsecure: DefaultConnectInsecure, MigrationsTable: "foo"}, + "", + }, + { + "configure connect insecure", + "rqlite://localhost:4001?x-connect-insecure=true", + "http://localhost:4001", + &Config{ConnectInsecure: true, MigrationsTable: DefaultMigrationsTable}, + "", + }, + { + "invalid migration table", + "rqlite://localhost:4001?x-migrations-table=sqlite_bar", + "", + nil, + "invalid value for x-migrations-table: bad parameter", + }, + { + "invalid connect insecure", + "rqlite://localhost:4001?x-connect-insecure=baz", + "", + nil, + "invalid value for x-connect-insecure: bad parameter", + }, + { + "invalid url", + string([]byte{0x7f}), + "", + nil, + "parse \"\\x7f\": net/url: invalid control character in URL", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + actualUrl, actualConfig, actualErr := parseUrl(tt.passedUrl) + if tt.expectedUrl != "" { + assert.Equal(t, tt.expectedUrl, actualUrl.String()) + } else { + assert.Nil(t, actualUrl) + } + + assert.Equal(t, tt.expectedConfig, actualConfig) + + if tt.expectedErr == "" { + assert.NoError(t, actualErr) + } else { + assert.EqualError(t, actualErr, tt.expectedErr) + } + }) + } +} diff --git a/go.mod b/go.mod index da117acd3..805aa148f 100644 --- a/go.mod +++ b/go.mod @@ -142,6 +142,7 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect + github.com/rqlite/gorqlite v0.0.0-20230708021416-2acd02b70b79 github.com/shopspring/decimal v1.2.0 // indirect github.com/sirupsen/logrus v1.9.2 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect diff --git a/go.sum b/go.sum index 700aff24e..d51fe677c 100644 --- a/go.sum +++ b/go.sum @@ -527,6 +527,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qq github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rqlite/gorqlite v0.0.0-20230708021416-2acd02b70b79 h1:V7x0hCAgL8lNGezuex1RW1sh7VXXCqfw8nXZti66iFg= +github.com/rqlite/gorqlite v0.0.0-20230708021416-2acd02b70b79/go.mod h1:xF/KoXmrRyahPfo5L7Szb5cAAUl53dMWBh9cMruGEZg= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= diff --git a/internal/cli/build_rqlite.go b/internal/cli/build_rqlite.go new file mode 100644 index 000000000..1e3e3a932 --- /dev/null +++ b/internal/cli/build_rqlite.go @@ -0,0 +1,8 @@ +//go:build rqlite +// +build rqlite + +package cli + +import ( + _ "github.com/golang-migrate/migrate/v4/database/rqlite" +) From cf03803fe006a053b44228bdc325b16d2f5d1643 Mon Sep 17 00:00:00 2001 From: Erik Swenson Date: Wed, 6 Dec 2023 16:02:36 -0700 Subject: [PATCH 19/32] Add rqlite 8.0.0 to tested database versions --- database/rqlite/rqlite_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/database/rqlite/rqlite_test.go b/database/rqlite/rqlite_test.go index 9d5c663e5..92ca02647 100644 --- a/database/rqlite/rqlite_test.go +++ b/database/rqlite/rqlite_test.go @@ -26,7 +26,8 @@ var opts = dktest.Options{ ReadyFunc: isReady, } var specs = []dktesting.ContainerSpec{ - {ImageName: "rqlite/rqlite:7.21.3", Options: opts}, + {ImageName: "rqlite/rqlite:7.21.4", Options: opts}, + {ImageName: "rqlite/rqlite:8.0.0", Options: opts}, } func isReady(ctx context.Context, c dktest.ContainerInfo) bool { From 669437c3b8d471674b886fe46baf4cbc3701a7e9 Mon Sep 17 00:00:00 2001 From: Erik Swenson Date: Thu, 14 Dec 2023 09:13:13 -0700 Subject: [PATCH 20/32] update rqlite 8 container version to 8.0.6 --- database/rqlite/rqlite_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/rqlite/rqlite_test.go b/database/rqlite/rqlite_test.go index 92ca02647..0372a117d 100644 --- a/database/rqlite/rqlite_test.go +++ b/database/rqlite/rqlite_test.go @@ -27,7 +27,7 @@ var opts = dktest.Options{ } var specs = []dktesting.ContainerSpec{ {ImageName: "rqlite/rqlite:7.21.4", Options: opts}, - {ImageName: "rqlite/rqlite:8.0.0", Options: opts}, + {ImageName: "rqlite/rqlite:8.0.6", Options: opts}, } func isReady(ctx context.Context, c dktest.ContainerInfo) bool { From 4078ef894116e7b1a72a3faaae4bd75276581d61 Mon Sep 17 00:00:00 2001 From: Dale Hui Date: Mon, 18 Dec 2023 23:44:05 -0800 Subject: [PATCH 21/32] New release prep * Update dktest from v0.3.16 to v0.4.0 to fix docker vulnerability * Fix linter issues * Update outdated GitHub Actions --- .github/workflows/ci.yaml | 26 +++++++++++++------------- database/parse_test.go | 17 +++++++++-------- go.mod | 14 +++++++------- go.sum | 30 ++++++++++++++++++------------ source/file/file_test.go | 16 +++++++++------- 5 files changed, 56 insertions(+), 47 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3e60c795d..06a0b17a0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,10 +9,10 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v5 with: - go-version: "1.20.x" - - uses: actions/checkout@v3 + go-version: "1.21.x" + - uses: actions/checkout@v4 - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: @@ -22,11 +22,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: ["1.19.x", "1.20.x"] + go: ["1.20.x", "1.21.x"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} @@ -60,19 +60,19 @@ jobs: # 3. When the workflow is triggered by a tag with `v` prefix if: ${{ success() && github.repository == 'golang-migrate/migrate' && startsWith(github.ref, 'refs/tags/v') }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: ruby/setup-ruby@v1 with: ruby-version: 2.7 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v5 with: - go-version: "1.19.x" + go-version: "1.21.x" - - uses: docker/setup-qemu-action@v1 - - uses: docker/setup-buildx-action@v1 - - uses: docker/login-action@v1 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 with: username: golangmigrate password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -80,7 +80,7 @@ jobs: - run: echo "SOURCE=$(make echo-source)" >> $GITHUB_ENV - run: echo "DATABASE=$(make echo-database)" >> $GITHUB_ENV - - uses: goreleaser/goreleaser-action@v2 + - uses: goreleaser/goreleaser-action@v5 with: version: latest args: release --rm-dist diff --git a/database/parse_test.go b/database/parse_test.go index 3709a6796..9c579ed7b 100644 --- a/database/parse_test.go +++ b/database/parse_test.go @@ -8,13 +8,15 @@ import ( ) const reservedChars = "!#$%&'()*+,/:;=?@[]" +const reservedCharTestNamePrefix = "reserved char " const baseUsername = "username" +const scheme = "database://" + // TestUserUnencodedReservedURLChars documents the behavior of using unencoded reserved characters in usernames with // net/url Parse() func TestUserUnencodedReservedURLChars(t *testing.T) { - scheme := "database://" urlSuffix := "password@localhost:12345/myDB?someParam=true" urlSuffixAndSep := ":" + urlSuffix @@ -64,7 +66,7 @@ func TestUserUnencodedReservedURLChars(t *testing.T) { testedChars := make([]string, 0, len(reservedChars)) for _, tc := range testcases { testedChars = append(testedChars, tc.char) - t.Run("reserved char "+tc.char, func(t *testing.T) { + t.Run(reservedCharTestNamePrefix+tc.char, func(t *testing.T) { s := scheme + baseUsername + tc.char + urlSuffixAndSep u, err := url.Parse(s) if err == nil { @@ -98,13 +100,12 @@ func TestUserUnencodedReservedURLChars(t *testing.T) { } func TestUserEncodedReservedURLChars(t *testing.T) { - scheme := "database://" urlSuffix := "password@localhost:12345/myDB?someParam=true" urlSuffixAndSep := ":" + urlSuffix for _, c := range reservedChars { c := string(c) - t.Run("reserved char "+c, func(t *testing.T) { + t.Run(reservedCharTestNamePrefix+c, func(t *testing.T) { encodedChar := "%" + hex.EncodeToString([]byte(c)) s := scheme + baseUsername + encodedChar + urlSuffixAndSep expectedUsername := baseUsername + c @@ -126,7 +127,7 @@ func TestUserEncodedReservedURLChars(t *testing.T) { // with net/url Parse() func TestPasswordUnencodedReservedURLChars(t *testing.T) { username := baseUsername - schemeAndUsernameAndSep := "database://" + username + ":" + schemeAndUsernameAndSep := scheme + username + ":" basePassword := "password" urlSuffixAndSep := "@localhost:12345/myDB?someParam=true" @@ -174,7 +175,7 @@ func TestPasswordUnencodedReservedURLChars(t *testing.T) { testedChars := make([]string, 0, len(reservedChars)) for _, tc := range testcases { testedChars = append(testedChars, tc.char) - t.Run("reserved char "+tc.char, func(t *testing.T) { + t.Run(reservedCharTestNamePrefix+tc.char, func(t *testing.T) { s := schemeAndUsernameAndSep + basePassword + tc.char + urlSuffixAndSep u, err := url.Parse(s) if err == nil { @@ -213,13 +214,13 @@ func TestPasswordUnencodedReservedURLChars(t *testing.T) { func TestPasswordEncodedReservedURLChars(t *testing.T) { username := baseUsername - schemeAndUsernameAndSep := "database://" + username + ":" + schemeAndUsernameAndSep := scheme + username + ":" basePassword := "password" urlSuffixAndSep := "@localhost:12345/myDB?someParam=true" for _, c := range reservedChars { c := string(c) - t.Run("reserved char "+c, func(t *testing.T) { + t.Run(reservedCharTestNamePrefix+c, func(t *testing.T) { encodedChar := "%" + hex.EncodeToString([]byte(c)) s := schemeAndUsernameAndSep + basePassword + encodedChar + urlSuffixAndSep expectedPassword := basePassword + c diff --git a/go.mod b/go.mod index da117acd3..4fe9eabc9 100644 --- a/go.mod +++ b/go.mod @@ -8,8 +8,8 @@ require ( github.com/aws/aws-sdk-go v1.34.0 github.com/cenkalti/backoff/v4 v4.1.2 github.com/cockroachdb/cockroach-go/v2 v2.1.1 - github.com/dhui/dktest v0.3.16 - github.com/docker/docker v20.10.24+incompatible + github.com/dhui/dktest v0.4.0 + github.com/docker/docker v24.0.7+incompatible github.com/docker/go-connections v0.4.0 github.com/fsouza/fake-gcs-server v1.17.0 github.com/go-sql-driver/mysql v1.5.0 @@ -151,14 +151,14 @@ require ( github.com/zeebo/xxh3 v1.0.2 // indirect gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.9.0 // indirect + golang.org/x/crypto v0.14.0 // indirect golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect golang.org/x/mod v0.10.0 // indirect - golang.org/x/net v0.10.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/term v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/go.sum b/go.sum index 700aff24e..bad84afa9 100644 --- a/go.sum +++ b/go.sum @@ -161,15 +161,15 @@ github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnG github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dhui/dktest v0.3.16 h1:i6gq2YQEtcrjKbeJpBkWjE8MmLZPYllcjOFbTZuPDnw= -github.com/dhui/dktest v0.3.16/go.mod h1:gYaA3LRmM8Z4vJl2MA0THIigJoZrwOansEOsp+kqxp0= +github.com/dhui/dktest v0.4.0 h1:z05UmuXZHO/bgj/ds2bGMBu8FI4WA+Ag/m3ghL+om7M= +github.com/dhui/dktest v0.4.0/go.mod h1:v/Dbz1LgCBOi2Uki2nUqLBGa83hWBGFMu5MrgMDCc78= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v20.10.24+incompatible h1:Ugvxm7a8+Gz6vqQYQQ2W7GYq5EUPaAiuPgIfVyI3dYE= -github.com/docker/docker v20.10.24+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= +github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= @@ -538,7 +538,6 @@ github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y= github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/snowflakedb/gosnowflake v1.6.19 h1:KSHXrQ5o7uso25hNIzi/RObXtnSGkFgie91X82KcvMY= @@ -626,8 +625,8 @@ golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -655,6 +654,7 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -689,9 +689,9 @@ golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -709,6 +709,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -754,14 +755,16 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -773,8 +776,9 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 h1:M73Iuj3xbbb9Uk1DYhzydthsj6oOd6l9bpuFcNoUvTs= @@ -813,6 +817,7 @@ golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -913,6 +918,7 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/postgres v1.0.8/go.mod h1:4eOzrI1MUfm6ObJU/UcmbXyiHSs8jSwH95G5P5dxcAg= diff --git a/source/file/file_test.go b/source/file/file_test.go index 33ca65e54..5680aa2a3 100644 --- a/source/file/file_test.go +++ b/source/file/file_test.go @@ -11,6 +11,8 @@ import ( st "github.com/golang-migrate/migrate/v4/source/testing" ) +const scheme = "file://" + func Test(t *testing.T) { tmpDir := t.TempDir() @@ -29,7 +31,7 @@ func Test(t *testing.T) { mustWriteFile(t, tmpDir, "7_foobar.down.sql", "7 down") f := &File{} - d, err := f.Open("file://" + tmpDir) + d, err := f.Open(scheme + tmpDir) if err != nil { t.Fatal(err) } @@ -48,7 +50,7 @@ func TestOpen(t *testing.T) { } f := &File{} - _, err := f.Open("file://" + tmpDir) // absolute path + _, err := f.Open(scheme + tmpDir) // absolute path if err != nil { t.Fatal(err) } @@ -108,7 +110,7 @@ func TestOpenDefaultsToCurrentDirectory(t *testing.T) { } f := &File{} - d, err := f.Open("file://") + d, err := f.Open(scheme) if err != nil { t.Fatal(err) } @@ -125,7 +127,7 @@ func TestOpenWithDuplicateVersion(t *testing.T) { mustWriteFile(t, tmpDir, "1_bar.up.sql", "") // 1 up f := &File{} - _, err := f.Open("file://" + tmpDir) + _, err := f.Open(scheme + tmpDir) if err == nil { t.Fatal("expected err") } @@ -135,7 +137,7 @@ func TestClose(t *testing.T) { tmpDir := t.TempDir() f := &File{} - d, err := f.Open("file://" + tmpDir) + d, err := f.Open(scheme + tmpDir) if err != nil { t.Fatal(err) } @@ -172,7 +174,7 @@ func BenchmarkOpen(b *testing.B) { b.ResetTimer() for n := 0; n < b.N; n++ { f := &File{} - _, err := f.Open("file://" + dir) + _, err := f.Open(scheme + dir) if err != nil { b.Error(err) } @@ -188,7 +190,7 @@ func BenchmarkNext(b *testing.B) { } }() f := &File{} - d, _ := f.Open("file://" + dir) + d, _ := f.Open(scheme + dir) b.ResetTimer() v, err := d.First() for n := 0; n < b.N; n++ { From b56728763786caae5daa9f745fc4eb47320f199d Mon Sep 17 00:00:00 2001 From: Dale Hui Date: Tue, 19 Dec 2023 00:02:27 -0800 Subject: [PATCH 22/32] Update from alpine 3.18 to 3.19 --- Dockerfile | 4 ++-- Dockerfile.github-actions | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index c576a57b0..779cbcab2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20-alpine3.18 AS builder +FROM golang:1.21-alpine3.19 AS builder ARG VERSION RUN apk add --no-cache git gcc musl-dev make @@ -15,7 +15,7 @@ COPY . ./ RUN make build-docker -FROM alpine:3.18 +FROM alpine:3.19 RUN apk add --no-cache ca-certificates diff --git a/Dockerfile.github-actions b/Dockerfile.github-actions index c9723c38c..9786e1210 100644 --- a/Dockerfile.github-actions +++ b/Dockerfile.github-actions @@ -1,4 +1,4 @@ -FROM alpine:3.18 +FROM alpine:3.19 RUN apk add --no-cache ca-certificates From 5ded96d97d64674bec6e1144082305184efa046d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Dec 2023 08:40:00 +0000 Subject: [PATCH 23/32] Bump golang.org/x/crypto from 0.14.0 to 0.17.0 Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.17.0. - [Commits](https://github.com/golang/crypto/compare/v0.14.0...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: indirect ... Signed-off-by: dependabot[bot] --- go.mod | 8 ++++---- go.sum | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 4fe9eabc9..1d83d7f46 100644 --- a/go.mod +++ b/go.mod @@ -151,14 +151,14 @@ require ( github.com/zeebo/xxh3 v1.0.2 // indirect gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.14.0 // indirect + golang.org/x/crypto v0.17.0 // indirect golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/term v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/go.sum b/go.sum index bad84afa9..83f1c4ded 100644 --- a/go.sum +++ b/go.sum @@ -625,8 +625,9 @@ golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -756,15 +757,17 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -777,8 +780,9 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 h1:M73Iuj3xbbb9Uk1DYhzydthsj6oOd6l9bpuFcNoUvTs= From 7d03609443c81852ee9b808b17443d9bd999ffe2 Mon Sep 17 00:00:00 2001 From: Erik Swenson Date: Tue, 19 Dec 2023 10:33:43 -0700 Subject: [PATCH 24/32] add 8.11 and 8.12 versions and remove debug logging --- database/rqlite/rqlite_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/database/rqlite/rqlite_test.go b/database/rqlite/rqlite_test.go index 0372a117d..c19f7476b 100644 --- a/database/rqlite/rqlite_test.go +++ b/database/rqlite/rqlite_test.go @@ -28,6 +28,8 @@ var opts = dktest.Options{ var specs = []dktesting.ContainerSpec{ {ImageName: "rqlite/rqlite:7.21.4", Options: opts}, {ImageName: "rqlite/rqlite:8.0.6", Options: opts}, + {ImageName: "rqlite/rqlite:8.11.1", Options: opts}, + {ImageName: "rqlite/rqlite:8.12.3", Options: opts}, } func isReady(ctx context.Context, c dktest.ContainerInfo) bool { @@ -68,7 +70,6 @@ func isReady(ctx context.Context, c dktest.ContainerInfo) bool { return false } - fmt.Printf("reporting ready status %+v\n", readyResp) return readyResp.Store.Ready } From c3ebd527d830253d20ceba1c3004584e99d9f0de Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Dec 2023 05:37:50 +0000 Subject: [PATCH 25/32] Bump google.golang.org/grpc from 1.55.0 to 1.56.3 Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.55.0 to 1.56.3. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.55.0...v1.56.3) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: indirect ... Signed-off-by: dependabot[bot] --- go.mod | 12 ++++++------ go.sum | 19 ++++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 0b36cc1ca..b4f08f765 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8 github.com/neo4j/neo4j-go-driver v1.8.1-0.20200803113522-b626aa943eba github.com/snowflakedb/gosnowflake v1.6.19 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.3 github.com/xanzy/go-gitlab v0.15.0 go.mongodb.org/mongo-driver v1.7.5 go.uber.org/atomic v1.7.0 @@ -78,7 +78,7 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 // indirect github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe // indirect - github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195 // indirect + github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 // indirect github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -86,8 +86,8 @@ require ( github.com/docker/go-units v0.5.0 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 // indirect - github.com/envoyproxy/go-control-plane v0.11.0 // indirect - github.com/envoyproxy/protoc-gen-validate v0.10.0 // indirect + github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f // indirect + github.com/envoyproxy/protoc-gen-validate v0.10.1 // indirect github.com/form3tech-oss/jwt-go v3.2.5+incompatible // indirect github.com/gabriel-vasile/mimetype v1.4.1 // indirect github.com/go-stack/stack v1.8.0 // indirect @@ -139,7 +139,7 @@ require ( github.com/opencontainers/image-spec v1.0.2 // indirect github.com/pierrec/lz4/v4 v4.1.16 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - github.com/pkg/errors v0.9.1 // indirect + github.com/pkg/errors v0.9.1 github.com/pmezard/go-difflib v1.0.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect github.com/rqlite/gorqlite v0.0.0-20230708021416-2acd02b70b79 @@ -165,7 +165,7 @@ require ( google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.55.0 // indirect + google.golang.org/grpc v1.56.3 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 18137c1f2..ee8a8fcb6 100644 --- a/go.sum +++ b/go.sum @@ -142,8 +142,8 @@ github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195 h1:58f1tJ1ra+zFINPlwLWvQsR9CzAKt2e+EWV2yX9oXQ4= -github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= +github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/cockroach-go/v2 v2.1.1 h1:3XzfSMuUT0wBe1a3o5C0eOTcArhmmFAg2Jzh/7hhKqo= @@ -186,11 +186,11 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.11.0 h1:jtLewhRR2vMRNnq2ZZUoCjUlgut+Y0+sDDWPOfwOi1o= -github.com/envoyproxy/go-control-plane v0.11.0/go.mod h1:VnHyVMpzcLvCFt9yUz1UnCwHLhwx1WguiVDV7pTG/tI= +github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f h1:7T++XKzy4xg7PKy+bM+Sa9/oe1OC88yz2hXQUISoXfA= +github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f/go.mod h1:sfYdkwUW4BA3PbKjySwjJy+O4Pu0h62rlqCMHNk+K+Q= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.10.0 h1:oIfnZFdC0YhpNNEX+SuIqko4cqqVZeN9IGTrhZje83Y= -github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= +github.com/envoyproxy/protoc-gen-validate v0.10.1 h1:c0g45+xCJhdgFGw7a5QAfdS4byAbud7miNWJ1WwEVf8= +github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= github.com/form3tech-oss/jwt-go v3.2.5+incompatible h1:/l4kBbb4/vGSsdtB5nUe8L7B9mImVMaBPw9L/0TBHU8= github.com/form3tech-oss/jwt-go v3.2.5+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -559,8 +559,9 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/xanzy/go-gitlab v0.15.0 h1:rWtwKTgEnXyNUGrOArN7yyc3THRkpYcKXIXia9abywQ= @@ -884,8 +885,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= +google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From 502648853050b90a9d0fef4b35447136bd07862b Mon Sep 17 00:00:00 2001 From: Dale Hui Date: Tue, 19 Dec 2023 22:41:22 -0800 Subject: [PATCH 26/32] Clean up require directive grouping --- go.mod | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/go.mod b/go.mod index cc0937cde..1f6bd3da0 100644 --- a/go.mod +++ b/go.mod @@ -41,8 +41,6 @@ require ( modernc.org/sqlite v1.18.1 ) -require golang.org/x/time v0.3.0 // indirect - require ( cloud.google.com/go v0.110.10 // indirect cloud.google.com/go/compute v1.23.3 // indirect @@ -161,6 +159,7 @@ require ( golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.3.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect From 691f687eb895737efe55c9f11b7cef8fc4e87d1e Mon Sep 17 00:00:00 2001 From: Dale Hui Date: Wed, 20 Dec 2023 00:28:14 -0800 Subject: [PATCH 27/32] Reformat ScyllaDB/Cassandra docs --- README.md | 5 ++--- database/cassandra/README.md | 12 ++++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ee6d19ee4..959601873 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,11 @@ Database drivers run migrations. [Add a new database?](database/driver.go) * [PGX v5](database/pgx/v5) * [Redshift](database/redshift) * [Ql](database/ql) -* [Cassandra](database/cassandra) -* [ScyllaDB](database/cassandra) +* [Cassandra / ScyllaDB](database/cassandra) * [SQLite](database/sqlite) * [SQLite3](database/sqlite3) ([todo #165](https://github.com/mattes/migrate/issues/165)) * [SQLCipher](database/sqlcipher) -* [MySQL/ MariaDB](database/mysql) +* [MySQL / MariaDB](database/mysql) * [Neo4j](database/neo4j) * [MongoDB](database/mongodb) * [CrateDB](database/crate) ([todo #170](https://github.com/mattes/migrate/issues/170)) diff --git a/database/cassandra/README.md b/database/cassandra/README.md index c138dff62..138104b7d 100644 --- a/database/cassandra/README.md +++ b/database/cassandra/README.md @@ -1,12 +1,16 @@ # Cassandra / ScyllaDB -* Drop command will not work on Cassandra 2.X because it rely on -system_schema table which comes with 3.X. Works for ScyllaDB. -* Other commands should work properly but are **not tested** +* `Drop()` method will not work on Cassandra 2.X because it rely on +system_schema table which comes with 3.X +* Other methods should work properly but are **not tested** * The Cassandra driver (gocql) does not natively support executing multiple statements in a single query. To allow for multiple statements in a single migration, you can use the `x-multi-statement` param. There are two important caveats: * This mode splits the migration text into separately-executed statements by a semi-colon `;`. Thus `x-multi-statement` cannot be used when a statement in the migration contains a string with a semi-colon. * The queries are not executed in any sort of transaction/batch, meaning you are responsible for fixing partial migrations. -* For ScyllaDB no additional configuration required as it is a drop-in replacement for Cassandra. + +**ScyllaDB** + +* No additional configuration is required since it is a drop-in replacement for Cassandra. +* The `Drop()` method` works for ScyllaDB 5.1 ## Usage From 091ad5db99b020ab8e6046b82435a283a1ce1803 Mon Sep 17 00:00:00 2001 From: Tommy Karlsson Date: Wed, 20 Dec 2023 10:25:29 +0100 Subject: [PATCH 28/32] Quote locktable from config in queries Defer rollback of transactions --- database/pgx/pgx.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/database/pgx/pgx.go b/database/pgx/pgx.go index 849785e38..7e42d29c9 100644 --- a/database/pgx/pgx.go +++ b/database/pgx/pgx.go @@ -23,6 +23,7 @@ import ( "github.com/jackc/pgconn" "github.com/jackc/pgerrcode" _ "github.com/jackc/pgx/v4/stdlib" + "github.com/lib/pq" ) const ( @@ -42,7 +43,7 @@ var ( DefaultMigrationsTable = "schema_migrations" DefaultMultiStatementMaxSize = 10 * 1 << 20 // 10 MB DefaultLockTable = "schema_lock" - DefaultLockStrategy = "advisory" + DefaultLockStrategy = LockStrategyAdvisory ) var ( @@ -293,13 +294,19 @@ func (p *Postgres) applyTableLock() error { if err != nil { return &database.Error{OrigErr: err, Err: "transaction start failed"} } + defer func() { + errRollback := tx.Rollback() + if errRollback != nil { + err = multierror.Append(err, errRollback) + } + }() aid, err := database.GenerateAdvisoryLockId(p.config.DatabaseName) if err != nil { return err } - query := "SELECT * FROM " + p.config.LockTable + " WHERE lock_id = $1" + query := "SELECT * FROM " + pq.QuoteIdentifier(p.config.LockTable) + " WHERE lock_id = $1" rows, err := tx.Query(query, aid) if err != nil { return database.Error{OrigErr: err, Err: "failed to fetch migration lock", Query: []byte(query)} @@ -317,7 +324,7 @@ func (p *Postgres) applyTableLock() error { return database.ErrLocked } - query = "INSERT INTO " + p.config.LockTable + " (lock_id) VALUES ($1)" + query = "INSERT INTO " + pq.QuoteIdentifier(p.config.LockTable) + " (lock_id) VALUES ($1)" if _, err := tx.Exec(query, aid); err != nil { return database.Error{OrigErr: err, Err: "failed to set migration lock", Query: []byte(query)} } @@ -345,7 +352,7 @@ func (p *Postgres) releaseTableLock() error { return err } - query := "DELETE FROM " + p.config.LockTable + " WHERE lock_id = $1" + query := "DELETE FROM " + pq.QuoteIdentifier(p.config.LockTable) + " WHERE lock_id = $1" if _, err := p.db.Exec(query, aid); err != nil { return database.Error{OrigErr: err, Err: "failed to release migration lock", Query: []byte(query)} } @@ -598,7 +605,7 @@ func (p *Postgres) ensureLockTable() error { return nil } - query = `CREATE TABLE "` + p.config.LockTable + `" (lock_id BIGINT NOT NULL PRIMARY KEY)` + query = `CREATE TABLE ` + pq.QuoteIdentifier(p.config.LockTable) + ` (lock_id BIGINT NOT NULL PRIMARY KEY)` if _, err := p.db.Exec(query); err != nil { return &database.Error{OrigErr: err, Query: []byte(query)} } From f2c4b52679390693211279658779107d41d0e872 Mon Sep 17 00:00:00 2001 From: Dale Hui Date: Wed, 20 Dec 2023 11:33:09 -0800 Subject: [PATCH 29/32] Update aws-sdk-go from v1.44.301 to v1.49.6 --- go.mod | 2 +- go.sum | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 9d1dd60e0..4fb259b69 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( cloud.google.com/go/storage v1.30.1 github.com/Azure/go-autorest/autorest/adal v0.9.16 github.com/ClickHouse/clickhouse-go v1.4.3 - github.com/aws/aws-sdk-go v1.44.301 + github.com/aws/aws-sdk-go v1.49.6 github.com/cenkalti/backoff/v4 v4.1.2 github.com/cockroachdb/cockroach-go/v2 v2.1.1 github.com/dhui/dktest v0.4.0 diff --git a/go.sum b/go.sum index e5615724c..0b001a7d0 100644 --- a/go.sum +++ b/go.sum @@ -76,10 +76,8 @@ github.com/apache/arrow/go/v10 v10.0.1 h1:n9dERvixoC/1JjDmBcs9FPaEryoANa2sCgVFo6 github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0= github.com/apache/thrift v0.16.0 h1:qEy6UW60iVOlUy+b9ZR0d5WzUWYGOo4HfopoyBaNmoY= github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU= -github.com/aws/aws-sdk-go v1.34.0 h1:brux2dRrlwCF5JhTL7MUT3WUwo9zfDHZZp3+g3Mvlmo= -github.com/aws/aws-sdk-go v1.34.0/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= -github.com/aws/aws-sdk-go v1.44.301 h1:VofuXktwHFTBUvoPiHxQis/3uKgu0RtgUwLtNujd3Zs= -github.com/aws/aws-sdk-go v1.44.301/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.49.6 h1:yNldzF5kzLBRvKlKz1S0bkvc2+04R1kt13KfBWQBfFA= +github.com/aws/aws-sdk-go v1.49.6/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v1.16.16 h1:M1fj4FE2lB4NzRb9Y0xdWsn2P0+2UHVxwKyOa4YJNjk= github.com/aws/aws-sdk-go-v2 v1.16.16/go.mod h1:SwiyXi/1zTUZ6KIAmLK5V5ll8SiURNUYOqTerZPaF9k= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.8 h1:tcFliCWne+zOuUfKNRn8JdFBuWPDuISDH08wD2ULkhk= @@ -389,7 +387,6 @@ github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aW github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= -github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= @@ -668,7 +665,6 @@ golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= @@ -680,7 +676,6 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= @@ -747,7 +742,6 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -756,7 +750,6 @@ golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= @@ -771,8 +764,6 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= From cd17c5a808d1889d17d73a68355c18d1dea6c49d Mon Sep 17 00:00:00 2001 From: Dale Hui Date: Wed, 20 Dec 2023 11:37:41 -0800 Subject: [PATCH 30/32] Drop support for Go 1.19 and add support for Go 1.21 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 959601873..359c7b3ab 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Coverage Status](https://img.shields.io/coveralls/github/golang-migrate/migrate/master.svg)](https://coveralls.io/github/golang-migrate/migrate?branch=master) [![packagecloud.io](https://img.shields.io/badge/deb-packagecloud.io-844fec.svg)](https://packagecloud.io/golang-migrate/migrate?filter=debs) [![Docker Pulls](https://img.shields.io/docker/pulls/migrate/migrate.svg)](https://hub.docker.com/r/migrate/migrate/) -![Supported Go Versions](https://img.shields.io/badge/Go-1.19%2C%201.20-lightgrey.svg) +![Supported Go Versions](https://img.shields.io/badge/Go-1.20%2C%201.21-lightgrey.svg) [![GitHub Release](https://img.shields.io/github/release/golang-migrate/migrate.svg)](https://github.com/golang-migrate/migrate/releases) [![Go Report Card](https://goreportcard.com/badge/github.com/golang-migrate/migrate/v4)](https://goreportcard.com/report/github.com/golang-migrate/migrate/v4) From d63a5c2c28faa1903f324d5ac3ac474c5c4682de Mon Sep 17 00:00:00 2001 From: Dale Hui Date: Wed, 20 Dec 2023 12:49:33 -0800 Subject: [PATCH 31/32] Only test against YugabyteDB LTS releases --- database/yugabytedb/yugabytedb_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/database/yugabytedb/yugabytedb_test.go b/database/yugabytedb/yugabytedb_test.go index 0c53ec13e..dc9103ece 100644 --- a/database/yugabytedb/yugabytedb_test.go +++ b/database/yugabytedb/yugabytedb_test.go @@ -31,12 +31,10 @@ var ( ReadyFunc: isReady, Timeout: time.Duration(60) * time.Second, } - // Released versions: https://docs.yugabyte.com/latest/releases/#current-supported-releases + // Released versions: https://docs.yugabyte.com/preview/releases/release-notes/ specs = []dktesting.ContainerSpec{ - {ImageName: "yugabytedb/yugabyte:2.6.16.0-b14", Options: opts}, - {ImageName: "yugabytedb/yugabyte:2.8.4.0-b30", Options: opts}, - {ImageName: "yugabytedb/yugabyte:2.12.2.0-b58", Options: opts}, - {ImageName: "yugabytedb/yugabyte:2.13.0.1-b2", Options: opts}, + {ImageName: "yugabytedb/yugabyte:2.14.10.4-b1", Options: opts}, + {ImageName: "yugabytedb/yugabyte:2.20.0.2-b1", Options: opts}, } ) From 5aa4670cbbe7b16f8d805cc5cf467443687e0231 Mon Sep 17 00:00:00 2001 From: Dale Hui Date: Wed, 20 Dec 2023 13:12:07 -0800 Subject: [PATCH 32/32] Fix GoReleaser deprecations https://goreleaser.com/deprecations/#-rm-dist https://goreleaser.com/deprecations/#sourcerlcp --- .github/workflows/ci.yaml | 2 +- .goreleaser.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 06a0b17a0..fbde0204f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -83,7 +83,7 @@ jobs: - uses: goreleaser/goreleaser-action@v5 with: version: latest - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 65d80468d..682248f65 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -87,7 +87,6 @@ release: prerelease: auto source: enabled: true - rlcp: true format: zip changelog: skip: false