mirror of https://github.com/dani/vroom.git
Drop table room_participants
This commit is contained in:
parent
1acb0795fb
commit
b54e652e37
|
@ -27,22 +27,6 @@ CREATE TABLE `rooms` (
|
|||
INDEX (`last_activity`)
|
||||
) ENGINE INNODB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `room_participants` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`room_id` INT UNSIGNED NOT NULL,
|
||||
`participant` VARCHAR(60) NOT NULL,
|
||||
`peer_id` VARCHAR(60) DEFAULT NULL,
|
||||
`role` VARCHAR(30) DEFAULT 'participant',
|
||||
`last_activity` DATETIME DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE (`room_id`, `participant`),
|
||||
UNIQUE (`room_id`, `peer_id`),
|
||||
UNIQUE (`participant`,`peer_id`),
|
||||
FOREIGN KEY (`room_id`) REFERENCES `rooms` (`id`)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE CASCADE
|
||||
) ENGINE INNODB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `email_notifications` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`room_id` INT UNSIGNED NOT NULL,
|
||||
|
|
|
@ -7,7 +7,7 @@ use base 'Exporter';
|
|||
our @EXPORT = qw/DB_VERSION COMPONENTS MOH JS_STRINGS API_ACTIONS/;
|
||||
|
||||
# Database version
|
||||
use constant DB_VERSION => 2;
|
||||
use constant DB_VERSION => 3;
|
||||
|
||||
# Components used to generate the credits part
|
||||
use constant COMPONENTS => {
|
||||
|
|
|
@ -75,3 +75,18 @@ if ($cur_ver < 2){
|
|||
print "Successfully upgraded to schema version 2\n";
|
||||
}
|
||||
|
||||
if ($cur_ver < 3){
|
||||
print "Upgrading the schema to version 3\n";
|
||||
eval {
|
||||
$dbh->begin_work;
|
||||
$dbh->do(qq{ DROP TABLE `room_participants` });
|
||||
$dbh->commit;
|
||||
};
|
||||
if ($@){
|
||||
print "An error occurred: " . $dbh->errstr . "\n";
|
||||
local $dbh->{RaiseError} = 0;
|
||||
$dbh->rollback;
|
||||
exit 255;
|
||||
};
|
||||
print "Successfully upgraded to schema version 3\n";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue