-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial DB Table #1213
Initial DB Table #1213
Conversation
Skipping CI for Draft Pull Request. |
Add one of following labels |
internal/storage/postsql/init.go
Outdated
@@ -20,6 +20,7 @@ const ( | |||
SubaccountStatesTableName = "subaccount_states" | |||
CreatedAtField = "created_at" | |||
InstancesArchivedTableName = "instances_archived" | |||
BindingssTableName = "bindings" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BindingssTableName = "bindings" | |
BindingsTableName = "bindings" |
internal/storage/postsql/write.go
Outdated
@@ -21,6 +21,37 @@ type writeSession struct { | |||
transaction *dbr.Tx | |||
} | |||
|
|||
func (ws writeSession) DeleteBinding(ID string) dberr.Error { | |||
_, err := ws.deleteFrom(BindingssTableName). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_, err := ws.deleteFrom(BindingssTableName). | |
_, err := ws.deleteFrom(BindingsTableName). |
internal/storage/postsql/write.go
Outdated
return dberr.AlreadyExists("binding with id %s already exist for runtime %s", binding.ID, binding.RuntimeID) | ||
} | ||
} | ||
return dberr.Internal("Failed to insert record to Instance table: %s", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return dberr.Internal("Failed to insert record to Instance table: %s", err) | |
return dberr.Internal("Failed to insert record to Binding table: %s", err) |
internal/model.go
Outdated
ExpireationSeconds int64 | ||
GenerationMethod string | ||
|
||
Version int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YAGNI?
CreatedAt: binding.CreatedAt, | ||
UpdatedAt: binding.UpdatedAt, | ||
ExpiredAt: binding.ExpiredAt, | ||
Version: binding.Version, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not present in the DB structure yet.
internal/storage/postsql/read.go
Outdated
return binding, nil | ||
} | ||
|
||
func (r readSession) ListBindings(runtimeID string) ([]dbmodel.BindingDTO, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Access not by index (yet)
consider adding Instance ID |
return sess.DeleteBinding(instanceID) | ||
} | ||
|
||
func (s *Binding) List(instanceID string) ([]internal.Binding, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ListByInstanceID
Description
Changes proposed in this pull request:
Related issue(s)
#1198 #284