Skip to content

Commit

Permalink
add migration for geomap
Browse files Browse the repository at this point in the history
  • Loading branch information
notandy committed Nov 20, 2023
1 parent cebc764 commit 475fc2b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
19 changes: 19 additions & 0 deletions db/migrations/mysql/000002_geographic_map.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright 2023 SAP SE
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

DROP TABLE IF EXISTS geographic_map_assignment;

DROP TABLE IF EXISTS geographic_map;
35 changes: 35 additions & 0 deletions db/migrations/mysql/000002_geographic_map.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2020 SAP SE
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

CREATE TABLE geographic_map
(
id VARCHAR(36) PRIMARY KEY DEFAULT UUID(),
name VARCHAR(255) NULL,
provisioning_status VARCHAR(16) NOT NULL DEFAULT 'PENDING_CREATE',
created_at TIMESTAMP NOT NULL DEFAULT now(),
updated_at TIMESTAMP NOT NULL DEFAULT now(),
default_datacenter VARCHAR(36) NOT NULL REFERENCES datacenter(id),
scope VARCHAR(8) NOT NULL DEFAULT 'private' CHECK ( scope IN ('private', 'public')),
project_id VARCHAR(36) NOT NULL,
provider VARCHAR(64) NOT NULL
);

CREATE TABLE geographic_map_assignment
(
geographic_map_id VARCHAR(36) NOT NULL REFERENCES geographic_map(id) ON DELETE CASCADE,
datacenter VARCHAR(36) NOT NULL REFERENCES datacenter(id),
country VARCHAR(2) NOT NULL
);

0 comments on commit 475fc2b

Please sign in to comment.