itime                => { type => 'timestamp', default => 'now()' },
   mtime                => { type => 'timestamp' },
   order_value          => { type => 'numeric', default => '0', not_null => 1, precision => 5, scale => 15 },
-  project_status_id    => { type => 'integer' },
+  project_status_id    => { type => 'integer', not_null => 1 },
   project_type_id      => { type => 'integer', not_null => 1 },
   projectnumber        => { type => 'text' },
   start_date           => { type => 'date' },
 
 INSERT INTO project_status (name, description, position) VALUES ('planning', 'In Planung',     2);
 INSERT INTO project_status (name, description, position) VALUES ('running',  'In Bearbeitung', 3);
 INSERT INTO project_status (name, description, position) VALUES ('done',     'Fertiggestellt', 4);
+
+UPDATE project
+SET project_status_id = (
+  SELECT id
+  FROM project_status
+  WHERE name = 'running'
+)
+WHERE project_status_id IS NULL;
+
+ALTER TABLE project ALTER COLUMN project_status_id SET NOT NULL;