fix: Fixed the dbTest units so they work (#6293)

* fix: Fixed the dbTest units so they work

* fix schema, should now pass
This commit is contained in:
Neil Lathwood
2017-03-29 22:13:30 +01:00
committed by Tony Murray
parent 962c47168c
commit cf509f138b
7 changed files with 13 additions and 6 deletions

View File

@@ -169,8 +169,8 @@ if ($sub_type == 'new-maintenance') {
'title' => $schedule['title'],
'notes' => $schedule['notes'],
'recurring' => $schedule['recurring'],
'start_recurring_dt' => ($schedule['start_recurring_dt'] != '0000-00-00' ? $schedule['start_recurring_dt']: '1970-01-01 00:00:01'),
'end_recurring_dt' => ($schedule['end_recurring_dt']!= '0000-00-00' ? $schedule['end_recurring_dt'] : '1970-01-01 00:00:01'),
'start_recurring_dt' => ($schedule['start_recurring_dt'] != '0000-00-00' ? $schedule['start_recurring_dt']: '1970-01-02 00:00:01'),
'end_recurring_dt' => ($schedule['end_recurring_dt']!= '0000-00-00' ? $schedule['end_recurring_dt'] : '1970-01-02 00:00:01'),
'start_recurring_hr' => substr($schedule['start_recurring_hr'], 0, 5),
'end_recurring_hr' => substr($schedule['end_recurring_hr'], 0, 5),
'recurring_day' => $schedule['recurring_day'],

View File

@@ -110,6 +110,10 @@ if (!module_selected('nodb', $init_modules)) {
die;
}
$database_db = mysqli_select_db($database_link, $config['db_name']);
if (!$database_db) {
mysqli_query($database_link, "CREATE DATABASE " . $config['db_name'] . " CHARACTER SET utf8 COLLATE utf8_unicode_ci");
$database_db = mysqli_select_db($database_link, $config['db_name']);
}
dbQuery("SET NAMES 'utf8'");
dbQuery("SET CHARACTER SET 'utf8'");
dbQuery("SET COLLATION_CONNECTION = 'utf8_unicode_ci'");

View File

@@ -1,2 +1,2 @@
ALTER TABLE `alert_schedule` CHANGE `start` `start` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:01', CHANGE `end` `end` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:01';
ALTER TABLE `alert_schedule` CHANGE `start` `start` DATETIME NOT NULL DEFAULT '1970-01-02 00:00:01', CHANGE `end` `end` DATETIME NOT NULL DEFAULT '1970-01-02 00:00:01';
ALTER TABLE alert_schedule ADD COLUMN `recurring` tinyint (1) UNSIGNED NOT NULL DEFAULT 0 AFTER `schedule_id`, ADD COLUMN `start_recurring_dt` DATE NOT NULL DEFAULT '1970-01-01 00:00:01' AFTER `end`, ADD COLUMN `end_recurring_dt` DATE DEFAULT NULL AFTER `start_recurring_dt`, ADD COLUMN `start_recurring_hr` TIME NOT NULL DEFAULT '00:00:00' AFTER `end_recurring_dt`, ADD COLUMN `end_recurring_hr` TIME NOT NULL DEFAULT '00:00:00' AFTER `start_recurring_hr`, ADD COLUMN `recurring_day` VARCHAR(15) AFTER `end_recurring_hr`;

View File

@@ -1,2 +1,2 @@
ALTER TABLE `eventlog` CHANGE `datetime` `datetime` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:01';
ALTER TABLE `eventlog` CHANGE `datetime` `datetime` DATETIME NOT NULL DEFAULT '1970-01-02 00:00:01';
ALTER TABLE `eventlog` ADD COLUMN `severity` INT(1) NULL DEFAULT 2 AFTER `reference`;

View File

@@ -1 +1 @@
ALTER TABLE `eventlog` CHANGE `datetime` `datetime` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:01';
ALTER TABLE `eventlog` CHANGE `datetime` `datetime` DATETIME NOT NULL DEFAULT '1970-01-02 00:00:01';

View File

@@ -1,3 +1,3 @@
ALTER TABLE `users` ADD `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `dashboard`;
ALTER TABLE `users` ADD `created_at` TIMESTAMP NOT NULL DEFAULT '1970-01-02 00:00:01' AFTER `dashboard`;
ALTER TABLE `users` ADD `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `created_at`;
ALTER TABLE `users` ADD `remeber_token` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL AFTER `updated_at`;

3
sql-schema/183.sql Normal file
View File

@@ -0,0 +1,3 @@
ALTER TABLE `users` CHANGE `created_at` `created_at` TIMESTAMP NOT NULL DEFAULT '1970-01-02 00:00:01';
ALTER TABLE `eventlog` CHANGE `datetime` `datetime` DATETIME NOT NULL DEFAULT '1970-01-02 00:00:01';
ALTER TABLE `alert_schedule` CHANGE `start` `start` DATETIME NOT NULL DEFAULT '1970-01-02 00:00:01', CHANGE `end` `end` DATETIME NOT NULL DEFAULT '1970-01-02 00:00:01';