Skip to content

Commit ed15ccf

Browse files
authored
chore: deprecate project schema version (#66)
1 parent 46d839c commit ed15ccf

12 files changed

+47
-82
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ override.tf.json
4040
# Ignore CLI configuration files
4141
.terraformrc
4242
terraform.rc
43+
44+
# Ignore docs overview
45+
docs/assets/overview.webp

api/project.go

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@ const (
3030
ProjectTenantModeEnabled ProjectTenantMode = "TENANT_MODE_ENABLED"
3131
)
3232

33-
// ProjectSchemaVersion is the schema version type for project.
34-
type ProjectSchemaVersion string
35-
36-
const (
37-
// ProjectSchemaVersionTimestamp is the timestamp schema version type in the project.
38-
ProjectSchemaVersionTimestamp ProjectSchemaVersion = "TIMESTAMP"
39-
// ProjectSchemaVersionSemantic is the semantic schema version type in the project.
40-
ProjectSchemaVersionSemantic ProjectSchemaVersion = "SEMANTIC"
41-
// ProjectSchemaVersionUnspecified is the unspecified schema version type in the project.
42-
ProjectSchemaVersionUnspecified ProjectSchemaVersion = "SCHEMA_VERSION_UNSPECIFIED"
43-
)
44-
4533
// ProjectSchemaChange is the schema change type for project.
4634
type ProjectSchemaChange string
4735

@@ -54,16 +42,15 @@ const (
5442

5543
// ProjectMessage is the API message for project.
5644
type ProjectMessage struct {
57-
Name string `json:"name"`
58-
Title string `json:"title"`
59-
Key string `json:"key"`
60-
Workflow ProjectWorkflow `json:"workflow"`
61-
Visibility ProjectVisibility `json:"visibility"`
62-
TenantMode ProjectTenantMode `json:"tenantMode"`
63-
DBNameTemplate string `json:"dbNameTemplate"`
64-
SchemaVersion ProjectSchemaVersion `json:"schemaVersion"`
65-
SchemaChange ProjectSchemaChange `json:"schemaChange"`
66-
State State `json:"state,omitempty"`
45+
Name string `json:"name"`
46+
Title string `json:"title"`
47+
Key string `json:"key"`
48+
Workflow ProjectWorkflow `json:"workflow"`
49+
Visibility ProjectVisibility `json:"visibility"`
50+
TenantMode ProjectTenantMode `json:"tenantMode"`
51+
DBNameTemplate string `json:"dbNameTemplate"`
52+
SchemaChange ProjectSchemaChange `json:"schemaChange"`
53+
State State `json:"state,omitempty"`
6754
}
6855

6956
// ListProjectMessage is the API message for list project response.

docs/data-sources/project.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The project data source.
2121

2222
### Read-Only
2323

24+
- `databases` (List of Object) The databases in the project. (see [below for nested schema](#nestedatt--databases))
2425
- `db_name_template` (String) The project db name template.
2526
- `id` (String) The ID of this resource.
2627
- `key` (String) The project key.
@@ -30,16 +31,17 @@ The project data source.
3031
- `title` (String) The project title.
3132
- `visibility` (String) The project visibility.
3233
- `workflow` (String) The project workflow.
33-
- `databases` (Block List) The databases in the project. (see [below for nested schema](#nestedblock--databases))
3434

35-
<a id="nestedblock--databases"></a>
35+
<a id="nestedatt--databases"></a>
3636
### Nested Schema for `databases`
3737

38-
#### Read-Only
38+
Read-Only:
39+
40+
- `instance` (String)
41+
- `labels` (Map of String)
42+
- `name` (String)
43+
- `schema_version` (String)
44+
- `successful_sync_time` (String)
45+
- `sync_state` (String)
46+
3947

40-
- `instance` (String) The instance resource id for the database.
41-
- `name` (String) The database name.
42-
- `labels` (Map of String) The deployment and policy control labels.
43-
- `schema_version` (String) The version of database schema.
44-
- `successful_sync_time` (String) The latest synchronization time.
45-
- `sync_state` (String) The existence of a database on latest sync.

docs/data-sources/project_list.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ The project data source list.
2929

3030
Read-Only:
3131

32+
- `databases` (List of Object) (see [below for nested schema](#nestedobjatt--projects--databases))
3233
- `db_name_template` (String)
3334
- `key` (String)
3435
- `resource_id` (String)
@@ -38,16 +39,17 @@ Read-Only:
3839
- `title` (String)
3940
- `visibility` (String)
4041
- `workflow` (String)
41-
- `databases` (Block List) The databases in the project. (see [below for nested schema](#nestedblock--databases))
4242

43-
<a id="nestedblock--databases"></a>
44-
### Nested Schema for `databases`
43+
<a id="nestedobjatt--projects--databases"></a>
44+
### Nested Schema for `projects.databases`
45+
46+
Read-Only:
47+
48+
- `instance` (String)
49+
- `labels` (Map of String)
50+
- `name` (String)
51+
- `schema_version` (String)
52+
- `successful_sync_time` (String)
53+
- `sync_state` (String)
4554

46-
#### Read-Only
4755

48-
- `instance` (String) The instance resource id for the database.
49-
- `name` (String) The database name.
50-
- `labels` (Map of String) The deployment and policy control labels.
51-
- `schema_version` (String) The version of database schema.
52-
- `successful_sync_time` (String) The latest synchronization time.
53-
- `sync_state` (String) The existence of a database on latest sync.

docs/resources/project.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,36 @@ The project resource.
2020
- `key` (String) The project unique key.
2121
- `resource_id` (String) The project unique resource id. Cannot change this after created.
2222
- `schema_change` (String) The project schema change type.
23-
- `schema_version` (String) The project schema version type. Cannot change this after created.
2423
- `title` (String) The project title.
2524
- `workflow` (String) The project workflow.
2625

2726
### Optional
2827

28+
- `databases` (Block List) The databases in the project. (see [below for nested schema](#nestedblock--databases))
2929
- `db_name_template` (String) The project db name template.
3030
- `tenant_mode` (String) The project tenant mode.
3131
- `visibility` (String) The project visibility. Cannot change this after created
32-
- `databases` (Block List) The databases in the project. (see [below for nested schema](#nestedblock--databases))
3332

3433
### Read-Only
3534

3635
- `id` (String) The ID of this resource.
3736

38-
3937
<a id="nestedblock--databases"></a>
4038
### Nested Schema for `databases`
4139

42-
#### Required
40+
Required:
4341

4442
- `instance` (String) The instance resource id for the database.
4543
- `name` (String) The database name.
4644

47-
#### Optional
45+
Optional:
4846

4947
- `labels` (Map of String) The deployment and policy control labels.
5048

51-
#### Read-Only
49+
Read-Only:
5250

5351
- `schema_version` (String) The version of database schema.
5452
- `successful_sync_time` (String) The latest synchronization time.
5553
- `sync_state` (String) The existence of a database on latest sync.
54+
55+

provider/data_source_project.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,6 @@ func setProjectWithDatabases(d *schema.ResourceData, project *api.ProjectMessage
156156
if err := d.Set("db_name_template", project.DBNameTemplate); err != nil {
157157
return diag.Errorf("cannot set db_name_template for project: %s", err.Error())
158158
}
159-
if err := d.Set("schema_version", project.SchemaVersion); err != nil {
160-
return diag.Errorf("cannot set schema_version for project: %s", err.Error())
161-
}
162159
if err := d.Set("schema_change", project.SchemaChange); err != nil {
163160
return diag.Errorf("cannot set schema_change for project: %s", err.Error())
164161
}

provider/data_source_project_list.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ func dataSourceProjectListRead(ctx context.Context, d *schema.ResourceData, m in
147147
proj["visibility"] = project.Visibility
148148
proj["tenant_mode"] = project.TenantMode
149149
proj["db_name_template"] = project.DBNameTemplate
150-
proj["schema_version"] = project.SchemaVersion
151150
proj["schema_change"] = project.SchemaChange
152151

153152
filter := fmt.Sprintf(`project == "%s"`, project.Name)

provider/data_source_project_list_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestAccProjectListDataSource(t *testing.T) {
2929
0,
3030
),
3131
internal.GetTestStepForDataSourceList(
32-
testAccCheckProjectResource(identifier, "dev-project", "dev project", "BYT", api.ProjectWorkflowUI, api.ProjectSchemaVersionSemantic, api.ProjectSchemaChangeDDL),
32+
testAccCheckProjectResource(identifier, "dev-project", "dev project", "BYT", api.ProjectWorkflowUI, api.ProjectSchemaChangeDDL),
3333
fmt.Sprintf("bytebase_project.%s", identifier),
3434
"bytebase_project_list",
3535
"after",

provider/data_source_project_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestAccProjectDataSource(t *testing.T) {
2929
// get single project test
3030
{
3131
Config: testAccCheckProjectDataSource(
32-
testAccCheckProjectResource(identifier, resourceID, title, key, api.ProjectWorkflowUI, api.ProjectSchemaVersionSemantic, api.ProjectSchemaChangeDDL),
32+
testAccCheckProjectResource(identifier, resourceID, title, key, api.ProjectWorkflowUI, api.ProjectSchemaChangeDDL),
3333
resourceName,
3434
identifier,
3535
resourceID,
@@ -39,7 +39,6 @@ func TestAccProjectDataSource(t *testing.T) {
3939
resource.TestCheckResourceAttr(resourceName, "title", title),
4040
resource.TestCheckResourceAttr(resourceName, "key", key),
4141
resource.TestCheckResourceAttr(resourceName, "workflow", string(api.ProjectWorkflowUI)),
42-
resource.TestCheckResourceAttr(resourceName, "schema_version", string(api.ProjectSchemaVersionSemantic)),
4342
resource.TestCheckResourceAttr(resourceName, "schema_change", string(api.ProjectSchemaChangeDDL)),
4443
),
4544
},

provider/internal/mock_client.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,6 @@ func (c *mockClient) CreateProject(_ context.Context, projectID string, project
578578
Visibility: project.Visibility,
579579
TenantMode: project.TenantMode,
580580
DBNameTemplate: project.DBNameTemplate,
581-
SchemaVersion: project.SchemaVersion,
582581
SchemaChange: project.SchemaChange,
583582
}
584583

0 commit comments

Comments
 (0)