diff --git a/sql/database-create.sql b/sql/database-create.sql
index 34ef99a1dfff9e9fd779dc9e3d3afb40a5fa0b27..134984877c6459ae52c99a62c698819d751af538 100644
--- a/sql/database-create.sql
+++ b/sql/database-create.sql
@@ -92,6 +92,8 @@ CREATE TABLE `apt_profiles` (
   `public` tinyint(1) NOT NULL default '0',
   `shared` tinyint(1) NOT NULL default '0',
   `listed` tinyint(1) NOT NULL default '0',
+  `locked` datetime default NULL,
+  `status` varchar(32) default NULL,
   `weburi` tinytext,
   `description` mediumtext,
   `rspec` mediumtext,
@@ -5206,6 +5208,36 @@ CREATE TABLE `vlans` (
   KEY `exptidx` (`exptidx`,`virtual`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
+--
+-- Table structure for table `web_sessions`
+--
+
+DROP TABLE IF EXISTS `web_sessions`;
+CREATE TABLE `web_sessions` ( 
+  `session_id` varchar(128) binary NOT NULL default '', 
+  `session_expires` datetime NOT NULL default '0000-00-00 00:00:00',
+  `session_data` text, 
+  PRIMARY KEY  (`session_id`) 
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `web_tasks`
+--
+
+DROP TABLE IF EXISTS `web_tasks`;
+CREATE TABLE `web_tasks` ( 
+  `task_id` varchar(128) binary NOT NULL default '', 
+  `created` datetime NOT NULL default '0000-00-00 00:00:00',
+  `modified` datetime NOT NULL default '0000-00-00 00:00:00',
+  `exited` datetime default NULL,
+  `process_id` int(11) default '0',
+  `object_uuid` varchar(40) NOT NULL default '',
+  `exitcode` tinyint(3) default '0',
+  `task_data` text, 
+  PRIMARY KEY  (`task_id`),
+  KEY `object_uuid` (`object_uuid`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
 --
 -- Table structure for table `webcams`
 --
diff --git a/sql/updates/4/393 b/sql/updates/4/393
new file mode 100644
index 0000000000000000000000000000000000000000..3bf561cde3ccf96ecaac29097ab76a9b03afe748
--- /dev/null
+++ b/sql/updates/4/393
@@ -0,0 +1,52 @@
+#
+# Add the relocatable flag to indicate whether the lba_low field must
+# be respected (0) or whether the image is "position independent" (1).
+#
+use strict;
+use libdb;
+
+sub DoUpdate($$$)
+{
+    my ($dbhandle, $dbname, $version) = @_;
+
+    if (!DBSlotExists("apt_profiles", "locked")) {
+	DBQueryFatal("ALTER TABLE apt_profiles ADD ".
+		     " `locked` datetime default NULL ".
+		     "   AFTER listed");
+    }
+    if (!DBSlotExists("apt_profiles", "status")) {
+	DBQueryFatal("ALTER TABLE apt_profiles ADD ".
+		     " `status` varchar(32) default NULL ".
+		     "   AFTER locked");
+    }
+    if (!DBTableExists("web_sessions")) {
+	DBQueryFatal("CREATE TABLE `web_sessions` ( ".
+		     " `session_id` varchar(128) binary NOT NULL default '', ".
+		     " `session_expires` datetime NOT NULL ".
+		     "          default '0000-00-00 00:00:00', ".
+		     " `session_data` text, ".
+		     " PRIMARY KEY  (`session_id`) ".
+		     ") ENGINE=MyISAM DEFAULT CHARSET=latin1");
+    }
+    if (!DBTableExists("web_tasks")) {
+	DBQueryFatal("CREATE TABLE `web_tasks` ( ".
+		     " `task_id` varchar(128) binary NOT NULL default '', ".
+		     " `created` datetime NOT NULL ".
+		     "             default '0000-00-00 00:00:00', ".
+		     " `modified` datetime NOT NULL ".
+		     "             default '0000-00-00 00:00:00', ".
+		     " `exited` datetime default NULL, ".
+		     " `process_id` int(11) default '0', ".
+		     " `object_uuid` varchar(40) NOT NULL default '', ".
+		     " `exitcode` tinyint(3) default '0', ".
+		     " `task_data` text, ".
+		     " PRIMARY KEY  (`task_id`), ".
+		     " KEY `object_uuid` (`object_uuid`) ".
+		     ") ENGINE=MyISAM DEFAULT CHARSET=latin1");
+    }
+    return 0;
+}
+
+# Local Variables:
+# mode:perl
+# End: