Skip to content
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

Drop database protection changes #870

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions google/spanner/admin/database/v1/spanner.yaml
Expand Up @@ -14,6 +14,7 @@ types:
- name: google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata
- name: google.spanner.admin.database.v1.RestoreDatabaseMetadata
- name: google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata
- name: google.spanner.admin.database.v1.UpdateDatabaseMetadata

documentation:
summary: |-
Expand Down
Expand Up @@ -12,6 +12,12 @@ interfaces:
poll_delay_multiplier: 1.5
max_poll_delay_millis: 45000
total_poll_timeout_millis: 86400000
- name: UpdateDatabase
long_running:
initial_poll_delay_millis: 20000
poll_delay_multiplier: 1.5
max_poll_delay_millis: 45000
total_poll_timeout_millis: 86400000
- name: UpdateDatabaseDdl
long_running:
initial_poll_delay_millis: 20000
Expand Down
Expand Up @@ -10,6 +10,10 @@
"service": "google.spanner.admin.database.v1.DatabaseAdmin",
"method": "GetDatabase"
},
{
"service": "google.spanner.admin.database.v1.DatabaseAdmin",
"method": "UpdateDatabase"
},
{
"service": "google.spanner.admin.database.v1.DatabaseAdmin",
"method": "UpdateDatabaseDdl"
Expand Down
51 changes: 51 additions & 0 deletions google/spanner/admin/database/v1/spanner_database_admin.proto
Expand Up @@ -27,6 +27,7 @@ import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "google/spanner/admin/database/v1/backup.proto";
import "google/spanner/admin/database/v1/common.proto";
import "google/protobuf/field_mask.proto";

option csharp_namespace = "Google.Cloud.Spanner.Admin.Database.V1";
option go_package = "google.golang.org/genproto/googleapis/spanner/admin/database/v1;database";
Expand Down Expand Up @@ -89,6 +90,19 @@ service DatabaseAdmin {
option (google.api.method_signature) = "name";
}

rpc UpdateDatabase(UpdateDatabaseRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
patch: "/v1/{database.name=projects/*/instances/*/databases/*}"
body: "database"
};
option (google.api.method_signature) = "database,update_mask";
option (google.longrunning.operation_info) = {
response_type: "Database"
metadata_type: "UpdateDatabaseMetadata"
};
}

// Updates the schema of a Cloud Spanner database by
// creating/altering/dropping tables, columns, indexes, etc. The returned
// [long-running operation][google.longrunning.Operation] will have a name of
Expand Down Expand Up @@ -449,6 +463,12 @@ message Database {

// Output only. The dialect of the Cloud Spanner Database.
DatabaseDialect database_dialect = 10 [(google.api.field_behavior) = OUTPUT_ONLY];

// Whether drop protection is enabled for this database. Defaults to false, if not set.
bool enable_drop_protection = 11;

// If true, the database is being updated. If false, there are no ongoing update operations for the database.
bool reconciling = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// The request for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
Expand Down Expand Up @@ -537,6 +557,37 @@ message GetDatabaseRequest {
];
}

// The request for [UpdateDatabase][DatabaseAdmin.UpdateDatabase].
message UpdateDatabaseRequest {
// Required. The database to update.
// The `name` field of the database is of the form
// `projects/<project>/instances/<instance>/databases/<database>`.
Database database = 1 [
(google.api.field_behavior) = REQUIRED
];

// Required. The list of fields to update. Currently, only
// `enable_drop_protection` field can be updated.
google.protobuf.FieldMask update_mask = 2 [
(google.api.field_behavior) = REQUIRED
];
}

// Metadata type for the operation returned by
// [UpdateDatabase][DatabaseAdmin.UpdateDatabase].
message UpdateDatabaseMetadata {
// The request for [UpdateDatabase][DatabaseAdmin.UpdateDatabase].
UpdateDatabaseRequest request = 1;

// The progress of the [UpdateDatabase][DatabaseAdmin.UpdateDatabase]
// operation.
OperationProgress progress = 2;

// The time at which this operation was cancelled. If set, this operation is
// in the process of undoing itself (which is best-effort).
google.protobuf.Timestamp cancel_time = 3;
}

// Enqueues the given DDL statements to be applied, in order but not
// necessarily all at once, to the database schema at some point (or
// points) in the future. The server checks that the statements
Expand Down