implement registration in backend

This commit is contained in:
Roland Schneider
2018-12-30 23:04:06 +01:00
parent b2bb210cee
commit e3b6bc08a7
32 changed files with 794 additions and 276 deletions

View File

@@ -0,0 +1,30 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m181227_210620_alter_table_event_registration_cancaled_at_allow_null extends Migration
{
public function up()
{
$this->execute("alter table event_registration modify canceled_at datetime null;");
}
public function down()
{
echo "m181227_210620_alter_table_event_registration_cancaled_at_allow_null cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@@ -0,0 +1,43 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m181227_215706_fix_trigger_event_seat_count_check extends Migration
{
public function up()
{
$this->execute("DROP TRIGGER IF EXISTS event_seat_count_check;");
$this->execute("CREATE TRIGGER event_seat_count_check
AFTER INSERT ON event_registration FOR EACH ROW
BEGIN
IF (SELECT coalesce(COUNT(id),0) FROM event_registration
WHERE canceled_at is null AND id_event = NEW.id_event)
>
(SELECT coalesce(seat_count,0) from event where id = NEW.id_event)
THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'MAX_SEAT_COUNT_EXCEEDED';
END IF;
END;
");
}
public function down()
{
echo "m181227_215706_fix_trigger_event_seat_count_check cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@@ -0,0 +1,31 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m181229_121344_alter_table_ticket_add_seat_count extends Migration
{
public function up()
{
$this->addColumn("ticket","reservation_count","int default 0");
$this->addColumn("ticket","max_reservation_count","int default 0");
}
public function down()
{
echo "m181229_121344_alter_table_ticket_add_seat_count cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@@ -0,0 +1,30 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m181230_100000_alter_table_ticket_type_add_reservation_count extends Migration
{
public function up()
{
$this->addColumn("ticket_type","max_reservation_count","int default 0");
}
public function down()
{
echo "m181230_100000_alter_table_ticket_type_add_reservation_count cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}