From 0ad04fe43a42f3c2b558e0d1f55a781b376f6b9f Mon Sep 17 00:00:00 2001
From: Rollulus Rouloul <rollulus@users.noreply.github.com>
Date: Mon, 26 Aug 2024 17:01:56 +0200
Subject: [PATCH 1/6] feat: Add Unwrap to PartialError (#815)

---
 provider_errors.go | 4 ++++
 provider_test.go   | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/provider_errors.go b/provider_errors.go
index 79a2cda2b..718bcbec8 100644
--- a/provider_errors.go
+++ b/provider_errors.go
@@ -42,3 +42,7 @@ func (e *PartialError) Error() string {
 		e.Failed.Source.Type, e.Failed.Source.Version, e.Err,
 	)
 }
+
+func (e *PartialError) Unwrap() error {
+	return e.Err
+}
diff --git a/provider_test.go b/provider_test.go
index 1b201b413..82676043e 100644
--- a/provider_test.go
+++ b/provider_test.go
@@ -35,7 +35,6 @@ func TestProvider(t *testing.T) {
 	check.Equal(t, len(sources), 2)
 	check.Equal(t, sources[0], newSource(goose.TypeSQL, "001_foo.sql", 1))
 	check.Equal(t, sources[1], newSource(goose.TypeSQL, "002_bar.sql", 2))
-
 }
 
 var (
@@ -76,3 +75,10 @@ ALTER TABLE my_foo DROP COLUMN timestamp;
 ALTER TABLE my_foo RENAME TO foo;
 `
 )
+
+func TestPartialErrorUnwrap(t *testing.T) {
+	err := &goose.PartialError{Err: goose.ErrNoCurrentVersion}
+
+	got := errors.Is(err, goose.ErrNoCurrentVersion)
+	check.Bool(t, got, true)
+}

From 3802b0ad2d14a64af82b0e3315e6ac11c574169a Mon Sep 17 00:00:00 2001
From: Juozas Vainauskas <71255955+JuozasVainauskas@users.noreply.github.com>
Date: Wed, 28 Aug 2024 01:21:56 +0300
Subject: [PATCH 2/6] mysql: do not use SERIAL alias in goose_db_version table
 creation (#816)

---
 internal/dialect/dialectquery/mysql.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/internal/dialect/dialectquery/mysql.go b/internal/dialect/dialectquery/mysql.go
index b14ef392b..1ce165cef 100644
--- a/internal/dialect/dialectquery/mysql.go
+++ b/internal/dialect/dialectquery/mysql.go
@@ -8,7 +8,7 @@ var _ Querier = (*Mysql)(nil)
 
 func (m *Mysql) CreateTable(tableName string) string {
 	q := `CREATE TABLE %s (
-		id serial NOT NULL,
+		id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
 		version_id bigint NOT NULL,
 		is_applied boolean NOT NULL,
 		tstamp timestamp NULL default now(),

From 3d6ee770a72c94243513c15abaf363d7bded0f07 Mon Sep 17 00:00:00 2001
From: Michael Fridman <mf192@icloud.com>
Date: Tue, 27 Aug 2024 18:50:49 -0400
Subject: [PATCH 3/6] postgres: update table to use identity instead of serial
 (#694)

---
 internal/dialect/dialectquery/postgres.go | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/internal/dialect/dialectquery/postgres.go b/internal/dialect/dialectquery/postgres.go
index 0faadf5e4..2def6c6ca 100644
--- a/internal/dialect/dialectquery/postgres.go
+++ b/internal/dialect/dialectquery/postgres.go
@@ -8,11 +8,10 @@ var _ Querier = (*Postgres)(nil)
 
 func (p *Postgres) CreateTable(tableName string) string {
 	q := `CREATE TABLE %s (
-		id serial NOT NULL,
+		id integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
 		version_id bigint NOT NULL,
 		is_applied boolean NOT NULL,
-		tstamp timestamp NULL default now(),
-		PRIMARY KEY(id)
+		tstamp timestamp NOT NULL DEFAULT now()
 	)`
 	return fmt.Sprintf(q, tableName)
 }

From e2ae02fed0ea08f77ed2c423bd14695c92b04272 Mon Sep 17 00:00:00 2001
From: Mike Fridman <mf192@icloud.com>
Date: Tue, 27 Aug 2024 18:58:14 -0400
Subject: [PATCH 4/6] chore: update CHANGELOG.md

---
 CHANGELOG.md | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index fb3485a82..f006d5fac 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,8 +7,11 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
 ## [Unreleased]
 
-- Update `WithDisableGlobalRegistry` behavior (#783). If set, this will ignore globally-registered
-  migrations instead of raising an error. Specifically, the following check is removed:
+- Minimum Go version is now 1.21
+- Add Unwrap to PartialError (#815)
+- Update `WithDisableGlobalRegistry` behavior (#783). When set, this will ignore globally-registered
+  migrationse entirely instead of the previous behavior of raising an error. Specifically, the
+  following check is removed:
 
 ```go
 if len(global) > 0 {
@@ -18,7 +21,24 @@ if len(global) > 0 {
 
 This enables creating isolated goose provider(s) in legacy environments where global migrations may
 be registered. Without updating this behavior, it would be impossible to use
-`WithDisableGlobalRegistry` in combination with `WithGoMigrations`.
+`WithDisableGlobalRegistry` in combination with provider-scoped `WithGoMigrations`.
+
+- Postgres, updated schema to use identity instead of serial and make `tstamp` not nullable (#556)
+
+```diff
+- id serial NOT NULL,
++ id integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
+
+- tstamp timestamp NULL default now(),
++ tstamp timestamp NOT NULL DEFAULT now()
+```
+
+- MySQL, updated schema to not use SERIAL alias (#816)
+
+```diff
+- id serial NOT NULL,
++ id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+```
 
 ## [v3.21.1]
 

From eb5641ec06ca754945220b3274bb13e247f48fc3 Mon Sep 17 00:00:00 2001
From: Hany <rudebono@gmail.com>
Date: Wed, 28 Aug 2024 08:37:23 +0900
Subject: [PATCH 5/6] chore: add clickhouse cloud example (#796)

---
 README.md         | 1 +
 cmd/goose/main.go | 1 +
 2 files changed, 2 insertions(+)

diff --git a/README.md b/README.md
index 041e99b50..86b4302cb 100644
--- a/README.md
+++ b/README.md
@@ -101,6 +101,7 @@ Examples:
     GOOSE_DRIVER=postgres GOOSE_DBSTRING="user=postgres dbname=postgres sslmode=disable" goose status
     GOOSE_DRIVER=mysql GOOSE_DBSTRING="user:password@/dbname" goose status
     GOOSE_DRIVER=redshift GOOSE_DBSTRING="postgres://user:password@qwerty.us-east-1.redshift.amazonaws.com:5439/db" goose status
+    GOOSE_DRIVER=clickhouse GOOSE_DBSTRING="clickhouse://user:password@qwerty.clickhouse.cloud:9440/dbname?secure=true&skip_verify=false" goose status
 
 Options:
 
diff --git a/cmd/goose/main.go b/cmd/goose/main.go
index 685b29b5c..82fca3c10 100644
--- a/cmd/goose/main.go
+++ b/cmd/goose/main.go
@@ -277,6 +277,7 @@ Examples:
     GOOSE_DRIVER=mysql GOOSE_DBSTRING="user:password@/dbname" goose status
     GOOSE_DRIVER=redshift GOOSE_DBSTRING="postgres://user:password@qwerty.us-east-1.redshift.amazonaws.com:5439/db" goose status
     GOOSE_DRIVER=turso GOOSE_DBSTRING="libsql://dbname.turso.io?authToken=token" goose status
+	GOOSE_DRIVER=clickhouse GOOSE_DBSTRING="clickhouse://user:password@qwerty.clickhouse.cloud:9440/dbname?secure=true&skip_verify=false" goose status
 
 Options:
 `

From 31799a95f73f02e5fe33be01374409489552a7a6 Mon Sep 17 00:00:00 2001
From: Mike Fridman <mf192@icloud.com>
Date: Sat, 31 Aug 2024 09:55:02 -0400
Subject: [PATCH 6/6] docs: improve wording around CreateVersionTable

---
 database/store.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/database/store.go b/database/store.go
index 0c7e44de8..ff0e714a8 100644
--- a/database/store.go
+++ b/database/store.go
@@ -27,8 +27,7 @@ type Store interface {
 	// Tablename is the name of the version table. This table is used to record applied migrations
 	// and must not be an empty string.
 	Tablename() string
-	// CreateVersionTable creates the version table, which is used to track migrations. When
-	// creating this table, the implementation MUST also insert a row for the initial version (0).
+	// CreateVersionTable creates the version table, which is used to track migrations.
 	CreateVersionTable(ctx context.Context, db DBTxConn) error
 	// Insert a version id into the version table.
 	Insert(ctx context.Context, db DBTxConn, req InsertRequest) error