Skip to content

Commit f0c61e4

Browse files
authored
Fix database schema (#254)
fixes #252
2 parents 2eb28aa + 4efa959 commit f0c61e4

4 files changed

Lines changed: 11 additions & 8 deletions

File tree

doc/80-Upgrading.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ You may use the following command to apply the database schema upgrade file:
2121
**MySQL:**
2222

2323
```
24-
# mysql -u root -p reporting /usr/share/icingaweb2/modules/reporting/schema/mysql-upgrades/1.0.3.sql
24+
# mysql -u root -p reporting < /usr/share/icingaweb2/modules/reporting/schema/mysql-upgrades/1.0.3.sql
2525
```
2626

2727
**PostgreSQL:**
@@ -42,7 +42,7 @@ Icinga Reporting version 1.0.0 requires a schema update for the database.
4242
You may use the following command to apply the database schema upgrade file:
4343

4444
```
45-
# mysql -u root -p reporting /usr/share/icingaweb2/modules/reporting/schema/mysql-upgrades/1.0.0.sql
45+
# mysql -u root -p reporting < /usr/share/icingaweb2/modules/reporting/schema/mysql-upgrades/1.0.0.sql
4646
```
4747

4848
## Upgrading to Version 0.10.0
@@ -54,7 +54,7 @@ Please find the upgrade script in **schema/mysql-upgrades**.
5454
You may use the following command to apply the database schema upgrade file:
5555

5656
```
57-
# mysql -u root -p reporting /usr/share/icingaweb2/modules/reporting/schema/mysql-upgrades/0.10.0.sql
57+
# mysql -u root -p reporting < /usr/share/icingaweb2/modules/reporting/schema/mysql-upgrades/0.10.0.sql
5858
```
5959

6060
## Upgrading to Version 0.9.1
@@ -68,5 +68,5 @@ Please find the upgrade script in **schema/mysql-migrations**.
6868
You may use the following command to apply the database schema upgrade file:
6969

7070
```
71-
# mysql -u root -p reporting /usr/share/icingaweb2/modules/reporting/schema/mysql-upgrades/0.9.1.sql
71+
# mysql -u root -p reporting < /usr/share/icingaweb2/modules/reporting/schema/mysql-upgrades/0.9.1.sql
7272
```

schema/mysql.schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ CREATE TABLE reporting_schema (
9494
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
9595

9696
INSERT INTO reporting_schema (version, timestamp, success)
97-
VALUES ('1.0.0', UNIX_TIMESTAMP() * 1000, 'y');
97+
VALUES ('1.0.3', UNIX_TIMESTAMP() * 1000, 'y');
9898

9999
-- CREATE TABLE share (
100100
-- id int(10) unsigned NOT NULL AUTO_INCREMENT,

schema/pgsql-upgrades/1.0.3.sql

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
UPDATE timeframe SET end = 'now' WHERE name = 'Current Week';
1+
UPDATE timeframe SET "end" = 'now' WHERE name = 'Current Week';
22

33
INSERT INTO reporting_schema (version, timestamp, success, reason)
4-
VALUES ('1.0.3', unix_timestamp() * 1000, 'y', NULL);
4+
VALUES ('1.0.3', unix_timestamp() * 1000, 'y', NULL)
5+
ON CONFLICT ON CONSTRAINT idx_reporting_schema_version DO UPDATE SET success = EXCLUDED.success,
6+
reason = EXCLUDED.reason,
7+
timestamp = EXCLUDED.timestamp;

schema/pgsql.schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,4 @@ CREATE TABLE reporting_schema (
9292
);
9393

9494
INSERT INTO reporting_schema (version, timestamp, success)
95-
VALUES ('1.0.0', UNIX_TIMESTAMP() * 1000, 'y');
95+
VALUES ('1.0.3', UNIX_TIMESTAMP() * 1000, 'y');

0 commit comments

Comments
 (0)