Drop table room_participants

master
Daniel Berteaud 10 years ago
parent 1acb0795fb
commit b54e652e37
  1. 16
      docs/database/schema.mysql
  2. 2
      lib/Vroom/Constants.pm
  3. 15
      scripts/db_upgrade.pl

@ -27,22 +27,6 @@ CREATE TABLE `rooms` (
INDEX (`last_activity`) INDEX (`last_activity`)
) ENGINE INNODB DEFAULT CHARSET=utf8; ) 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` ( CREATE TABLE `email_notifications` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`room_id` INT UNSIGNED NOT NULL, `room_id` INT UNSIGNED NOT NULL,

@ -7,7 +7,7 @@ use base 'Exporter';
our @EXPORT = qw/DB_VERSION COMPONENTS MOH JS_STRINGS API_ACTIONS/; our @EXPORT = qw/DB_VERSION COMPONENTS MOH JS_STRINGS API_ACTIONS/;
# Database version # Database version
use constant DB_VERSION => 2; use constant DB_VERSION => 3;
# Components used to generate the credits part # Components used to generate the credits part
use constant COMPONENTS => { use constant COMPONENTS => {

@ -75,3 +75,18 @@ if ($cur_ver < 2){
print "Successfully upgraded to schema version 2\n"; 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…
Cancel
Save