Skip to content

Commit

Permalink
fix: resolve migration issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Sep 1, 2020
1 parent b17bf58 commit b545e15
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 51 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": "b8293f1c-010f-45d9-b809-f3fc5365ba80",
"value": "foobar@ory.sh",
"via": "email"
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "45e867e9-2745-4f16-8dd4-84334a252b61",
"value": "foo@ory.sh",
"verified": false,
"via": "email",
"status": "pending",
"verified_at": null
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "c2427b6d-312b-46d9-9285-536db7ae11fd",
"value": "foobar@ory.sh",
"verified": false,
"via": "email",
"status": "pending",
"verified_at": null
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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"
}
1 change: 0 additions & 1 deletion persistence/sql/migratest/migration_refresh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

}
15 changes: 10 additions & 5 deletions persistence/sql/migratest/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
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;

0 comments on commit b545e15

Please sign in to comment.