diff --git a/go.mod b/go.mod index ffc47eab15ad..70199fd9a8ad 100644 --- a/go.mod +++ b/go.mod @@ -54,7 +54,7 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 // indirect github.com/ory/analytics-go/v4 v4.0.0 - github.com/ory/cli v0.0.25-0.20200830213701-48ff64a35727 + github.com/ory/cli v0.0.27 github.com/ory/dockertest v3.3.5+incompatible github.com/ory/dockertest/v3 v3.5.4 github.com/ory/go-acc v0.1.0 diff --git a/go.sum b/go.sum index 42aadf6327c4..f5fac96c6547 100644 --- a/go.sum +++ b/go.sum @@ -352,8 +352,6 @@ github.com/gobuffalo/events v1.4.1/go.mod h1:SjXgWKpeSuvQDvGhgMz5IXx3Czu+IbL+XPL github.com/gobuffalo/fizz v1.0.12/go.mod h1:C0sltPxpYK8Ftvf64kbsQa2yiCZY4RZviurNxXdAKwc= github.com/gobuffalo/fizz v1.9.8/go.mod h1:w1FEn1yKNVCc49KnADGyYGRPH7jFON3ak4Bj1yUudHo= github.com/gobuffalo/fizz v1.10.0/go.mod h1:J2XGPO0AfJ1zKw7+2BA+6FEGAkyEsdCOLvN93WCT2WI= -github.com/gobuffalo/fizz v1.12.1-0.20200830211954-9d93b59ca79a h1:y52Nujtd0ilFyRwCQ602a+1tMD2Nd2XvTAcw7RnmvFI= -github.com/gobuffalo/fizz v1.12.1-0.20200830211954-9d93b59ca79a/go.mod h1:cXLjhE5p3iuIes6AGZ/9+dfyOkehlB2Vldj0Iw2Uu38= github.com/gobuffalo/fizz v1.13.0 h1:XzcBh8DLZH2BgEH77p6q+EKbd8FZyyUXgokUmKXk5ow= github.com/gobuffalo/fizz v1.13.0/go.mod h1:cXLjhE5p3iuIes6AGZ/9+dfyOkehlB2Vldj0Iw2Uu38= github.com/gobuffalo/flect v0.0.0-20180907193754-dc14d8acaf9f/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= @@ -1046,8 +1044,8 @@ github.com/openzipkin/zipkin-go v0.2.2 h1:nY8Hti+WKaP0cRsSeQ026wU03QsM762XBeCXBb github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/ory/analytics-go/v4 v4.0.0 h1:KQ2P00j9dbj4lDC/Albw/zn/scK67041RhqeW5ptsbw= github.com/ory/analytics-go/v4 v4.0.0/go.mod h1:FMx9cLRD9xN+XevPvZ5FDMfignpmcqPP6FUKnJ9/MmE= -github.com/ory/cli v0.0.25-0.20200830213701-48ff64a35727 h1:HoH1xPI+mVZO8xVyAfnAcvlxWqjfXY/t+rkovxYYzXM= -github.com/ory/cli v0.0.25-0.20200830213701-48ff64a35727/go.mod h1:V/iB7aUCfoB2r/DEUSva+7GHVg7kLviukdhHZm7bOsA= +github.com/ory/cli v0.0.27 h1:4dfDDqSzIGUcR/LXzmqI6bnMa/c0Ao0S4Uw3PI2ACWw= +github.com/ory/cli v0.0.27/go.mod h1:DrhqIZ67p55fetGyczTpU+amx3WGIMKOj75mSSbYJ+U= github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/ory/dockertest/v3 v3.5.4 h1:rYijlJuraj8D4OgC1DpYpCV8SGXrkviT3RVrjFy7OFc= @@ -1087,7 +1085,6 @@ github.com/ory/x v0.0.93/go.mod h1:lfcTaGXpTZs7IEQAW00r9EtTCOxD//SiP5uWtNiz31g= github.com/ory/x v0.0.110/go.mod h1:DJfkE3GdakhshNhw4zlKoRaL/ozg/lcTahA9OCih2BE= github.com/ory/x v0.0.127 h1:goEspwhiKRoKRMBb6T6nDiv5L2mMU4EQUGwu90WM+Ao= github.com/ory/x v0.0.127/go.mod h1:FwUujfFuCj5d+xgLn4fGMYPnzriR5bdAIulFXMtnK0M= -github.com/ory/x v0.0.131/go.mod h1:BMzD4kJYW5/GHoBJndjO0lFy7igXz81UfpXzBQplscQ= github.com/ory/x v0.0.148 h1:LLTGOS0gVcNgqFN1Nmq5CgfJEwhI8wnvDhpKXMreCWE= github.com/ory/x v0.0.148/go.mod h1:kYT14ajKGfDV8pRPRzQD3begYqRISZq1IQUgOVliQCE= github.com/parnurzeal/gorequest v0.2.15/go.mod h1:3Kh2QUMJoqw3icWAecsyzkpY7UzRfDhbRdTjtNwNiUE= diff --git a/persistence/sql/migratest/fixtures/identity_recovery_address/5ff66179-c240-4703-b0d8-494592cefff5.json b/persistence/sql/migratest/fixtures/identity_recovery_address/5ff66179-c240-4703-b0d8-494592cefff5.json deleted file mode 100644 index 0637a088a01e..000000000000 --- a/persistence/sql/migratest/fixtures/identity_recovery_address/5ff66179-c240-4703-b0d8-494592cefff5.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/persistence/sql/migratest/fixtures/identity_recovery_address/a251ebc2-880c-4f76-a8f3-38e6940eab0e.json b/persistence/sql/migratest/fixtures/identity_recovery_address/a251ebc2-880c-4f76-a8f3-38e6940eab0e.json deleted file mode 100644 index 14bd416e2664..000000000000 --- a/persistence/sql/migratest/fixtures/identity_recovery_address/a251ebc2-880c-4f76-a8f3-38e6940eab0e.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "id": "b8293f1c-010f-45d9-b809-f3fc5365ba80", - "value": "foobar@ory.sh", - "via": "email" - } -] \ No newline at end of file diff --git a/persistence/sql/migratest/fixtures/identity_recovery_address/b8293f1c-010f-45d9-b809-f3fc5365ba80.json b/persistence/sql/migratest/fixtures/identity_recovery_address/b8293f1c-010f-45d9-b809-f3fc5365ba80.json new file mode 100644 index 000000000000..1253f2411779 --- /dev/null +++ b/persistence/sql/migratest/fixtures/identity_recovery_address/b8293f1c-010f-45d9-b809-f3fc5365ba80.json @@ -0,0 +1,5 @@ +{ + "id": "b8293f1c-010f-45d9-b809-f3fc5365ba80", + "value": "foobar@ory.sh", + "via": "email" +} \ No newline at end of file diff --git a/persistence/sql/migratest/fixtures/identity_recovery_address/d7b9addb-ac15-4bc2-9fa5-562e0bf48755.json b/persistence/sql/migratest/fixtures/identity_recovery_address/d7b9addb-ac15-4bc2-9fa5-562e0bf48755.json deleted file mode 100644 index 0637a088a01e..000000000000 --- a/persistence/sql/migratest/fixtures/identity_recovery_address/d7b9addb-ac15-4bc2-9fa5-562e0bf48755.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/persistence/sql/migratest/fixtures/identity_verification_address/45e867e9-2745-4f16-8dd4-84334a252b61.json b/persistence/sql/migratest/fixtures/identity_verification_address/45e867e9-2745-4f16-8dd4-84334a252b61.json new file mode 100644 index 000000000000..87f6a098c8fa --- /dev/null +++ b/persistence/sql/migratest/fixtures/identity_verification_address/45e867e9-2745-4f16-8dd4-84334a252b61.json @@ -0,0 +1,8 @@ +{ + "id": "45e867e9-2745-4f16-8dd4-84334a252b61", + "value": "foo@ory.sh", + "verified": false, + "via": "email", + "status": "pending", + "verified_at": null +} \ No newline at end of file diff --git a/persistence/sql/migratest/fixtures/identity_verification_address/5ff66179-c240-4703-b0d8-494592cefff5.json b/persistence/sql/migratest/fixtures/identity_verification_address/5ff66179-c240-4703-b0d8-494592cefff5.json deleted file mode 100644 index 11373f724c11..000000000000 --- a/persistence/sql/migratest/fixtures/identity_verification_address/5ff66179-c240-4703-b0d8-494592cefff5.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "id": "45e867e9-2745-4f16-8dd4-84334a252b61", - "value": "foo@ory.sh", - "verified": false, - "via": "email", - "status": "pending", - "verified_at": null - } -] \ No newline at end of file diff --git a/persistence/sql/migratest/fixtures/identity_verification_address/a251ebc2-880c-4f76-a8f3-38e6940eab0e.json b/persistence/sql/migratest/fixtures/identity_verification_address/a251ebc2-880c-4f76-a8f3-38e6940eab0e.json deleted file mode 100644 index 3e6684279c23..000000000000 --- a/persistence/sql/migratest/fixtures/identity_verification_address/a251ebc2-880c-4f76-a8f3-38e6940eab0e.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "id": "c2427b6d-312b-46d9-9285-536db7ae11fd", - "value": "foobar@ory.sh", - "verified": false, - "via": "email", - "status": "pending", - "verified_at": null - }, - { - "id": "b2d59320-8564-4400-a39f-a22a497a23f1", - "value": "foobar+without-code@ory.sh", - "verified": false, - "via": "email", - "status": "pending", - "verified_at": null - } -] \ No newline at end of file diff --git a/persistence/sql/migratest/fixtures/identity_verification_address/b2d59320-8564-4400-a39f-a22a497a23f1.json b/persistence/sql/migratest/fixtures/identity_verification_address/b2d59320-8564-4400-a39f-a22a497a23f1.json new file mode 100644 index 000000000000..485ff8a086c4 --- /dev/null +++ b/persistence/sql/migratest/fixtures/identity_verification_address/b2d59320-8564-4400-a39f-a22a497a23f1.json @@ -0,0 +1,8 @@ +{ + "id": "b2d59320-8564-4400-a39f-a22a497a23f1", + "value": "foobar+without-code@ory.sh", + "verified": false, + "via": "email", + "status": "pending", + "verified_at": null +} \ No newline at end of file diff --git a/persistence/sql/migratest/fixtures/identity_verification_address/c2427b6d-312b-46d9-9285-536db7ae11fd.json b/persistence/sql/migratest/fixtures/identity_verification_address/c2427b6d-312b-46d9-9285-536db7ae11fd.json new file mode 100644 index 000000000000..752fdc08058a --- /dev/null +++ b/persistence/sql/migratest/fixtures/identity_verification_address/c2427b6d-312b-46d9-9285-536db7ae11fd.json @@ -0,0 +1,8 @@ +{ + "id": "c2427b6d-312b-46d9-9285-536db7ae11fd", + "value": "foobar@ory.sh", + "verified": false, + "via": "email", + "status": "pending", + "verified_at": null +} \ No newline at end of file diff --git a/persistence/sql/migratest/fixtures/identity_verification_address/d7b9addb-ac15-4bc2-9fa5-562e0bf48755.json b/persistence/sql/migratest/fixtures/identity_verification_address/d7b9addb-ac15-4bc2-9fa5-562e0bf48755.json deleted file mode 100644 index 0637a088a01e..000000000000 --- a/persistence/sql/migratest/fixtures/identity_verification_address/d7b9addb-ac15-4bc2-9fa5-562e0bf48755.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/persistence/sql/migratest/fixtures/verification_token/ee56574d-2f0c-43f6-8d26-0062938ae330.json b/persistence/sql/migratest/fixtures/verification_token/ee56574d-2f0c-43f6-8d26-0062938ae330.json new file mode 100644 index 000000000000..5d6526cda37e --- /dev/null +++ b/persistence/sql/migratest/fixtures/verification_token/ee56574d-2f0c-43f6-8d26-0062938ae330.json @@ -0,0 +1,6 @@ +{ + "id": "ee56574d-2f0c-43f6-8d26-0062938ae330", + "verification_address": null, + "expires_at": "2013-10-07T08:23:19Z", + "issued_at": "2013-10-07T08:23:19Z" +} \ No newline at end of file diff --git a/persistence/sql/migratest/fixtures/verification_token/f81fd924-23bb-4cdf-8fa0-56253eff6cc9.json b/persistence/sql/migratest/fixtures/verification_token/f81fd924-23bb-4cdf-8fa0-56253eff6cc9.json new file mode 100644 index 000000000000..f2743cf5a48b --- /dev/null +++ b/persistence/sql/migratest/fixtures/verification_token/f81fd924-23bb-4cdf-8fa0-56253eff6cc9.json @@ -0,0 +1,6 @@ +{ + "id": "f81fd924-23bb-4cdf-8fa0-56253eff6cc9", + "verification_address": null, + "expires_at": "2013-10-07T08:23:19Z", + "issued_at": "2013-10-07T08:23:19Z" +} \ No newline at end of file diff --git a/persistence/sql/migratest/migration_refresh_test.go b/persistence/sql/migratest/migration_refresh_test.go index a1cc30ccad0a..5b72fdf78000 100644 --- a/persistence/sql/migratest/migration_refresh_test.go +++ b/persistence/sql/migratest/migration_refresh_test.go @@ -14,5 +14,4 @@ func writeFixtureOnError(t *testing.T, err error, actual interface{}, location s content, err := json.MarshalIndent(actual, "", " ") require.NoError(t, err) require.NoError(t, ioutil.WriteFile(location, content, 0666)) - } diff --git a/persistence/sql/migratest/migration_test.go b/persistence/sql/migratest/migration_test.go index 7d2b0314c423..10d2f21c97cb 100644 --- a/persistence/sql/migratest/migration_test.go +++ b/persistence/sql/migratest/migration_test.go @@ -44,17 +44,17 @@ func TestMigrations(t *testing.T) { require.NoError(t, sqlite.Open()) connections := map[string]*pop.Connection{ - // "sqlite": sqlite, + "sqlite": sqlite, } l := logrusx.New("", "", logrusx.ForceLevel(logrus.TraceLevel)) if !testing.Short() { dockertest.Parallel([]func(){ func() { - // connections["postgres"] = dockertest.ConnectToTestPostgreSQLPop(t) + connections["postgres"] = dockertest.ConnectToTestPostgreSQLPop(t) }, func() { - // connections["mysql"] = dockertest.ConnectToTestMySQLPop(t) + connections["mysql"] = dockertest.ConnectToTestMySQLPop(t) }, func() { connections["cockroach"] = dockertest.ConnectToTestCockroachDBPop(t) @@ -109,8 +109,13 @@ func TestMigrations(t *testing.T) { actual, err := d.Registry().PrivilegedIdentityPool().GetIdentityConfidential(context.Background(), id.ID) require.NoError(t, err) - compareWithFixture(t, actual.VerifiableAddresses, "identity_verification_address", id.ID.String()) - compareWithFixture(t, actual.RecoveryAddresses, "identity_recovery_address", id.ID.String()) + for _, a := range actual.VerifiableAddresses { + compareWithFixture(t, a, "identity_verification_address", a.ID.String()) + } + + for _, a := range actual.RecoveryAddresses { + compareWithFixture(t, a, "identity_recovery_address", a.ID.String()) + } // Prevents ordering to get in the way. actual.VerifiableAddresses = nil diff --git a/persistence/sql/migrations/sql/20200830172221_recovery_token_expires.cockroach.up.sql b/persistence/sql/migrations/sql/20200830172221_recovery_token_expires.cockroach.up.sql index adb3e1df19c3..290d644e3d90 100644 --- a/persistence/sql/migrations/sql/20200830172221_recovery_token_expires.cockroach.up.sql +++ b/persistence/sql/migrations/sql/20200830172221_recovery_token_expires.cockroach.up.sql @@ -5,4 +5,5 @@ ALTER TABLE "identity_recovery_tokens" RENAME COLUMN "selfservice_recovery_flow_ ALTER TABLE "identity_recovery_tokens" ADD COLUMN "selfservice_recovery_flow_id" UUID;COMMIT TRANSACTION;BEGIN TRANSACTION; UPDATE "identity_recovery_tokens" SET "selfservice_recovery_flow_id" = "_selfservice_recovery_flow_id_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION; ALTER TABLE "identity_recovery_tokens" DROP COLUMN "_selfservice_recovery_flow_id_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION; -ALTER TABLE "identity_recovery_tokens" ADD CONSTRAINT "identity_recovery_tokens_selfservice_recovery_requests_id_fk" FOREIGN KEY ("selfservice_recovery_flow_id") REFERENCES "selfservice_recovery_flows" ("id") ON UPDATE NO ACTION ON DELETE CASCADE;COMMIT TRANSACTION;BEGIN TRANSACTION; \ No newline at end of file +CREATE INDEX "identity_recovery_tokens_selfservice_recovery_requests_id_idx" ON "identity_recovery_tokens" ("selfservice_recovery_flow_id");COMMIT TRANSACTION;BEGIN TRANSACTION; +ALTER TABLE "identity_recovery_tokens" ADD CONSTRAINT "identity_recovery_tokens_selfservice_recovery_requests_id_fk" FOREIGN KEY ("selfservice_recovery_flow_id") REFERENCES "selfservice_recovery_flows" ("id") ON UPDATE NO ACTION ON DELETE CASCADE;COMMIT TRANSACTION;BEGIN TRANSACTION;