Skip to content

Commit 29a989b

Browse files
Database Migration Lab
1 parent 824822a commit 29a989b

4 files changed

Lines changed: 47 additions & 6 deletions

File tree

build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,3 @@ bootRun.environment([
2121
test.environment([
2222
"WELCOME_MESSAGE": "Hello from test",
2323
])
24-
25-
task sayHello() {
26-
doLast {
27-
println "hi"
28-
}
29-
}

ci/pipeline.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,22 @@ jobs:
6060
- name: deploy-review
6161
plan:
6262
- get: pal-tracker
63+
passed: [build]
6364
- get: pal-tracker-artifacts
6465
trigger: true
6566
passed: [build]
67+
- task: migrate database
68+
file: pal-tracker/ci/migrateDatabase.yml
69+
params:
70+
CF_API_URL: {{cf-api-url}}
71+
CF_USERNAME: {{cf-username}}
72+
CF_PASSWORD: {{cf-password}}
73+
CF_ORG: {{cf-org}}
74+
CF_SPACE: review
75+
MYSQL_IP: {{mysql-ip}}
76+
DATABASE_NAME: {{review-database-name}}
77+
DATABASE_USERNAME: {{review-database-username}}
78+
DATABASE_PASSWORD: {{review-database-password}}
6679
- put: review-deployment
6780
params:
6881
manifest: pal-tracker/manifest-review.yml
@@ -73,8 +86,21 @@ jobs:
7386
- name: deploy-production
7487
plan:
7588
- get: pal-tracker
89+
passed: [deploy-review]
7690
- get: pal-tracker-artifacts
7791
passed: [deploy-review]
92+
- task: migrate database
93+
file: pal-tracker/ci/migrateDatabase.yml
94+
params:
95+
CF_API_URL: {{cf-api-url}}
96+
CF_USERNAME: {{cf-username}}
97+
CF_PASSWORD: {{cf-password}}
98+
CF_ORG: {{cf-org}}
99+
CF_SPACE: production
100+
MYSQL_IP: {{mysql-ip}}
101+
DATABASE_NAME: {{production-database-name}}
102+
DATABASE_USERNAME: {{production-database-username}}
103+
DATABASE_PASSWORD: {{production-database-password}}
78104
- put: production-deployment
79105
params:
80106
manifest: pal-tracker/manifest-production.yml
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
DROP DATABASE IF EXISTS tracker_dev;
2+
DROP DATABASE IF EXISTS tracker_test;
3+
4+
CREATE DATABASE tracker_dev;
5+
CREATE DATABASE tracker_test;
6+
7+
CREATE USER IF NOT EXISTS 'tracker'@'localhost'
8+
IDENTIFIED BY '';
9+
GRANT ALL PRIVILEGES ON tracker_dev.* TO 'tracker' @'localhost';
10+
GRANT ALL PRIVILEGES ON tracker_test.* TO 'tracker' @'localhost';
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CREATE TABLE time_entries (
2+
id BIGINT(20) NOT NULL AUTO_INCREMENT,
3+
project_id BIGINT(20),
4+
user_id BIGINT(20),
5+
date DATE,
6+
hours INT,
7+
8+
PRIMARY KEY (id)
9+
)
10+
ENGINE = innodb
11+
DEFAULT CHARSET = utf8;

0 commit comments

Comments
 (0)