Commit 59ed8b41 authored by Leigh Stoller's avatar Leigh Stoller

DB changes for APT.

parent 49d0cbf5
......@@ -9,10 +9,12 @@ CREATE TABLE `geni_users` (
`last_activity` datetime default NULL,
`locked` datetime default NULL,
`archived` datetime default NULL,
`status` enum('active','archived','frozen') NOT NULL default 'frozen',
`status` enum('active','unverified','frozen') NOT NULL default 'unverified',
`name` tinytext,
`email` tinytext,
`sa_uuid` varchar(40) NOT NULL default '',
`uuid` varchar(40) NOT NULL default '',
`auth_token` varchar(32) default NULL,
PRIMARY KEY (`idx`),
KEY `hrn` (`hrn`),
UNIQUE KEY `uuid` (`uuid`)
......@@ -211,6 +213,7 @@ CREATE TABLE `geni_userkeys` (
`type` enum('ssh','password') NOT NULL default 'ssh',
`uuid` varchar(40) NOT NULL default '',
`created` datetime default NULL,
`internal` tinyint(1) NOT NULL default '0',
`key` text,
INDEX `uuid` (`uuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......@@ -363,3 +366,15 @@ CREATE TABLE `client_slivers` (
PRIMARY KEY (`idx`),
INDEX `slice_uuid` (`slice_idx`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `quickvms`;
CREATE TABLE `quickvms` (
`uuid` varchar(40) NOT NULL default '',
`slice_uuid` varchar(40) NOT NULL default '',
`creator_uuid` varchar(40) NOT NULL default '',
`name` tinytext,
`status` varchar(32) default NULL,
`profile` tinytext,
`manifest` mediumtext,
PRIMARY KEY (`uuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
#
# Changes to geni_user for quick containers.
#
use strict;
use GeniDB;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
DBSetDefault($dbhandle);
my $type = DBSlotType("geni_users", "status");
if (!$type) {
Fatal("Could not get type for 'status' in 'geni_users'");
}
if (! ($type =~ /unverified/)) {
DBQueryFatal("alter table geni_users modify `status` ".
" enum('active','unverified','frozen') ".
" NOT NULL default 'unverified'");
}
if (!DBSlotExists("geni_users", "auth_token")) {
DBQueryFatal("alter table geni_users add ".
" `auth_token` varchar(32) default NULL");
}
if (!DBSlotExists("geni_userkeys", "internal")) {
DBQueryFatal("alter table geni_userkeys add ".
" `internal` tinyint(1) NOT NULL default '0' ".
" after created");
}
if (!DBTableExists("quickvms")) {
DBQueryFatal("CREATE TABLE `quickvms` ( ".
" `uuid` varchar(40) NOT NULL default '', ".
" `slice_uuid` varchar(40) NOT NULL default '', ".
" `creator_uuid` varchar(40) NOT NULL default '', ".
" `name` tinytext, ".
" `status` varchar(32) default NULL, ".
" `profile` tinytext, ".
" `manifest` mediumtext, ".
" PRIMARY KEY (`uuid`) ".
") ENGINE=MyISAM DEFAULT CHARSET=latin1");
}
return 0;
}
1;
# Local Variables:
# mode:perl
# End:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment