mirror of https://github.com/dani/vroom.git
Drop the owner column in rooms table, useless
This commit is contained in:
parent
a7efdd54a7
commit
601632c07b
|
@ -6,12 +6,11 @@ CREATE TABLE `config` (
|
|||
UNIQUE (`key`)
|
||||
) ENGINE INNODB DEFAULT CHARSET=utf8;
|
||||
INSERT INTO `config` (`key`,`value`)
|
||||
VALUES ('schema_version', '5');
|
||||
VALUES ('schema_version', '6');
|
||||
|
||||
CREATE TABLE `rooms` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(120) NOT NULL,
|
||||
`owner` VARCHAR(60) DEFAULT NULL,
|
||||
`create_date` DATETIME DEFAULT NULL,
|
||||
`last_activity` DATETIME DEFAULT NULL,
|
||||
`locked` TINYINT UNSIGNED DEFAULT '0',
|
||||
|
|
|
@ -7,7 +7,7 @@ use base 'Exporter';
|
|||
our @EXPORT = qw/DB_VERSION COMPONENTS MOH JS_STRINGS API_ACTIONS/;
|
||||
|
||||
# Database version
|
||||
use constant DB_VERSION => 5;
|
||||
use constant DB_VERSION => 6;
|
||||
|
||||
# Components used to generate the credits part
|
||||
use constant COMPONENTS => {
|
||||
|
|
|
@ -128,3 +128,20 @@ if ($cur_ver < 5){
|
|||
print "Successfully upgraded to schema version 5\n";
|
||||
}
|
||||
|
||||
if ($cur_ver < 6){
|
||||
print "Upgrading the schema to version 6\n";
|
||||
eval {
|
||||
$dbh->begin_work;
|
||||
$dbh->do(qq{ ALTER TABLE `rooms` DROP COLUMN `owner` });
|
||||
$dbh->do(qq{ UPDATE `config` SET `value`='6' WHERE `key`='schema_version' });
|
||||
$dbh->commit;
|
||||
};
|
||||
if ($@){
|
||||
print "An error occurred: " . $dbh->errstr . "\n";
|
||||
local $dbh->{RaiseError} = 0;
|
||||
$dbh->rollback;
|
||||
exit 255;
|
||||
};
|
||||
print "Successfully upgraded to schema version 6\n";
|
||||
}
|
||||
|
||||
|
|
14
vroom.pl
14
vroom.pl
|
@ -197,7 +197,7 @@ helper logout => sub {
|
|||
# Requires two args: the name of the room and the session name of the creator
|
||||
helper create_room => sub {
|
||||
my $self = shift;
|
||||
my ($name,$owner) = @_;
|
||||
my ($name) = @_;
|
||||
# Convert room names to lowercase
|
||||
if ($name ne lc $name){
|
||||
$name = lc $name;
|
||||
|
@ -213,16 +213,14 @@ helper create_room => sub {
|
|||
$self->db->prepare('INSERT INTO `rooms`
|
||||
(`name`,
|
||||
`create_date`,
|
||||
`last_activity`,
|
||||
`owner`)
|
||||
`last_activity`)
|
||||
VALUES (?,
|
||||
CONVERT_TZ(NOW(), @@session.time_zone, \'+00:00\'),
|
||||
CONVERT_TZ(NOW(), @@session.time_zone, \'+00:00\'),
|
||||
?)');
|
||||
CONVERT_TZ(NOW(), @@session.time_zone, \'+00:00\')
|
||||
)');
|
||||
};
|
||||
$sth->execute(
|
||||
$name,
|
||||
$owner
|
||||
$name
|
||||
);
|
||||
$self->app->log->info("Room $name created by " . $self->get_name);
|
||||
# Etherpad integration ? If so, create the corresponding pad
|
||||
|
@ -1434,7 +1432,7 @@ any '/api' => sub {
|
|||
$json->{msg} = $self->l('ERROR_NAME_CONFLICT');
|
||||
return $self->render(json => $json, status => 409);
|
||||
}
|
||||
if (!$self->create_room($req->{param}->{room},$self->get_name)){
|
||||
if (!$self->create_room($req->{param}->{room})){
|
||||
$json->{err} = 'ERROR_OCCURRED';
|
||||
$json->{msg} = $self->l('ERROR_OCCURRED');
|
||||
return $self->render(json => $json, status => 500);
|
||||
|
|
Loading…
Reference in New Issue