Skip to content

Commit

Permalink
Add missing migration
Browse files Browse the repository at this point in the history
  • Loading branch information
seizadi committed Jan 11, 2020
1 parent e4be481 commit 6ec2ee2
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 3 deletions.
22 changes: 20 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,24 @@ func (m *CmdbClient) CreateStage(req *pb.CreateStageRequest) (*pb.CreateStageRes
return res, nil
}


func (m *CmdbClient) GetLifecycles() (*pb.ListLifecyclesResponse, error) {

// We can now create stubs that wrap conn:
stub := pb.NewLifecyclesClient(m.Conn)

// Now we can use the stub to make RPCs
ctx := metadata.NewOutgoingContext(context.Background(),
metadata.Pairs("Authorization", "Bearer "+m.ApiKey))
reqList := &pb.ListLifecycleRequest{}
respList, err := stub.List(ctx, reqList)
if err != nil {
return nil, err
}

return respList, nil
}

func (m *CmdbClient) CreateEnvironment(req *pb.CreateEnvironmentRequest) (*pb.CreateEnvironmentResponse, error) {

// We can now create stubs that wrap conn:
Expand Down Expand Up @@ -208,10 +226,10 @@ func (m *CmdbClient) CreateApplicationInstance(req *pb.CreateApplicationInstance
return res, nil
}

func (m *CmdbClient) CreateChartVersion(req *pb.CreateChartVersionRequest) (*pb.CreateChartVersionResponse, error) {
func (m *CmdbClient) CreateChartVersion(req *pb.CreateAppVersionRequest) (*pb.CreateAppVersionResponse, error) {

// We can now create stubs that wrap conn:
stub := pb.NewChartVersionsClient(m.Conn)
stub := pb.NewAppVersionsClient(m.Conn)

// Now we can use the stub to make RPCs
ctx := metadata.NewOutgoingContext(context.Background(),
Expand Down
4 changes: 4 additions & 0 deletions db/migrations/00008_app_configs.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

DROP TRIGGER app_configs_updated_at on app_configs;

DROP TABLE app_configs;
18 changes: 18 additions & 0 deletions db/migrations/00008_app_configs.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

CREATE TABLE app_configs (
id serial primary key,
account_id text,
created_at timestamptz DEFAULT current_timestamp,
updated_at timestamptz DEFAULT NULL,
name text DEFAULT NULL,
description text DEFAULT NULL,
config_yaml text DEFAULT NULL,
application_id int REFERENCES applications(id) ON DELETE CASCADE,
lifecycle_id int REFERENCES lifecycles(id) ON DELETE CASCADE
);

CREATE TRIGGER app_configs_updated_at
BEFORE UPDATE OR INSERT ON app_configs
FOR EACH ROW
EXECUTE PROCEDURE set_updated_at();

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pkg/pb/cmdb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ service Lifecycles {


// ------------------------------------------------------------
// AppConfig represents a custom configuration for Application
// dro represents a custom configuration for Application
// ------------------------------------------------------------
message AppConfig {
option (gorm.opts) = {
Expand Down

0 comments on commit 6ec2ee2

Please sign in to comment.