Skip to content
Snippets Groups Projects
Commit 74658534 authored by Rasmus Fuhse's avatar Rasmus Fuhse Committed by Jan-Hendrik Willms
Browse files

Resolve "Fehler bei Migration CreateCwUnitsTable"

Closes #2144

Merge request studip/studip!1386
parent 218fd2a4
No related branches found
No related tags found
1 merge request!4Draft: Icon creation
...@@ -20,7 +20,7 @@ class CreateCwUnitsTable extends Migration ...@@ -20,7 +20,7 @@ class CreateCwUnitsTable extends Migration
`public` TINYINT(4) NOT NULL DEFAULT '1', `public` TINYINT(4) NOT NULL DEFAULT '1',
`creator_id` CHAR(32) COLLATE latin1_bin DEFAULT NULL, `creator_id` CHAR(32) COLLATE latin1_bin DEFAULT NULL,
`release_date` INT(11) UNSIGNED DEFAULT NULL, `release_date` INT(11) UNSIGNED DEFAULT NULL,
`withdraw_date` INT(11) UNSIGNED NOT NULL, `withdraw_date` INT(11) UNSIGNED DEFAULT NULL,
`mkdate` INT(11) UNSIGNED NOT NULL, `mkdate` INT(11) UNSIGNED NOT NULL,
`chdate` INT(11) UNSIGNED NOT NULL, `chdate` INT(11) UNSIGNED NOT NULL,
...@@ -36,8 +36,8 @@ class CreateCwUnitsTable extends Migration ...@@ -36,8 +36,8 @@ class CreateCwUnitsTable extends Migration
// create unit for each courseware root node // create unit for each courseware root node
$insert = $db->prepare( $insert = $db->prepare(
"INSERT INTO `cw_units` (`range_id`, `range_type`, `structural_element_id`, `content_type`, `public`, `creator_id`) "INSERT INTO `cw_units` (`range_id`, `range_type`, `structural_element_id`, `content_type`, `public`, `creator_id`, `mkdate`, `chdate`)
VALUES (?, ?, ?, 'courseware', true, ?)" VALUES (?, ?, ?, 'courseware', true, ?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP())"
); );
foreach ($cw_root_nodes as $courseware) { foreach ($cw_root_nodes as $courseware) {
$insert->execute([$courseware['range_id'], $courseware['range_type'], $courseware['id'], $courseware['owner_id']]); $insert->execute([$courseware['range_id'], $courseware['range_type'], $courseware['id'], $courseware['owner_id']]);
......
...@@ -100,8 +100,8 @@ class UnitsCreate extends JsonApiController ...@@ -100,8 +100,8 @@ class UnitsCreate extends JsonApiController
'content_type' => 'courseware', 'content_type' => 'courseware',
'creator_id' => $user->id, 'creator_id' => $user->id,
'public' => self::arrayGet($json, 'data.attributes.public', ''), 'public' => self::arrayGet($json, 'data.attributes.public', ''),
'release_date' => self::arrayGet($json, 'data.attributes.release-date', ''), 'release_date' => self::arrayGet($json, 'data.attributes.release-date'),
'withdraw_date' => self::arrayGet($json, 'data.attributes.withdraw-date', ''), 'withdraw_date' => self::arrayGet($json, 'data.attributes.withdraw-date'),
]); ]);
$unit->store(); $unit->store();
...@@ -119,4 +119,3 @@ class UnitsCreate extends JsonApiController ...@@ -119,4 +119,3 @@ class UnitsCreate extends JsonApiController
return $type_map[$type] ?? null; return $type_map[$type] ?? null;
} }
} }
...@@ -99,8 +99,8 @@ class Unit extends \SimpleORMap ...@@ -99,8 +99,8 @@ class Unit extends \SimpleORMap
'content_type' => 'courseware', 'content_type' => 'courseware',
'creator_id' => $user->id, 'creator_id' => $user->id,
'public' => '', 'public' => '',
'release_date' => '', 'release_date' => null,
'withdraw_date' => '', 'withdraw_date' => null,
]); ]);
$newUnit->store(); $newUnit->store();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment