Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Commit

Permalink
feat!: Migrations removal (#262)
Browse files Browse the repository at this point in the history
* Remove unused migration functionality

* Remove migrations from provider and cqproto

* add Signature() and Serial

* Add transactionality

* Signatures should take dialect into account

* Add test for signatures

Co-authored-by: Kemal Hadimli <[email protected]>
  • Loading branch information
disq and disq authored May 24, 2022
1 parent 674da34 commit 82b8981
Show file tree
Hide file tree
Showing 23 changed files with 447 additions and 1,616 deletions.
22 changes: 2 additions & 20 deletions cqproto/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func (g GRPCClient) GetProviderSchema(ctx context.Context, _ *GetProviderSchemaR
Name: res.GetName(),
Version: res.GetVersion(),
ResourceTables: tablesFromProto(res.GetResourceTables()),
Migrations: migrationsFromProto(res.GetMigrations()),
}

return resp, nil
Expand Down Expand Up @@ -140,7 +139,6 @@ func (g *GRPCServer) GetProviderSchema(ctx context.Context, _ *internal.GetProvi
Name: resp.Name,
Version: resp.Version,
ResourceTables: tablesToProto(resp.ResourceTables),
Migrations: migrationsToProto(resp.Migrations),
}, nil

}
Expand Down Expand Up @@ -274,6 +272,7 @@ func tableFromProto(v *internal.Table) *schema.Table {
Columns: cols,
Relations: rels,
Options: opts,
Serial: v.GetSerial(),
}
}

Expand Down Expand Up @@ -327,6 +326,7 @@ func tableToProto(in *schema.Table) *internal.Table {
Options: &internal.TableCreationOptions{
PrimaryKeys: in.Options.PrimaryKeys,
},
Serial: in.Serial,
}
}

Expand Down Expand Up @@ -437,24 +437,6 @@ func diagnosticsFromProto(resourceName string, in []*internal.Diagnostic) diag.D
return diagnostics
}

func migrationsFromProto(in map[string]*internal.DialectMigration) map[string]map[string][]byte {
ret := make(map[string]map[string][]byte, len(in))
for k := range in {
ret[k] = in[k].Migrations
}
return ret
}

func migrationsToProto(in map[string]map[string][]byte) map[string]*internal.DialectMigration {
ret := make(map[string]*internal.DialectMigration, len(in))
for k := range in {
ret[k] = &internal.DialectMigration{
Migrations: in[k],
}
}
return ret
}

func moduleInfoFromProto(in map[uint32]*internal.GetModuleInfo_Response_ModuleInfo) map[uint32]ModuleInfo {
ret := make(map[uint32]ModuleInfo, len(in))
for ver := range in {
Expand Down
Loading

0 comments on commit 82b8981

Please sign in to comment.