diff --git a/.github/clean_events_sql.php b/.github/clean_events_sql.php
new file mode 100644
index 000000000..004b5b15a
--- /dev/null
+++ b/.github/clean_events_sql.php
@@ -0,0 +1,91 @@
+ "/*!40101 SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci */;",
+ '/*!50003 CREATE*/'=>'CREATE',
+ '/*!50106 CREATE*/'=>'CREATE',
+ '/*!50003 TRIGGER'=>'TRIGGER',
+ '/*!50106 EVENT '=>'EVENT',
+ 'END */;;' => "END ;;\n",
+ 'END */ ;;'=>"END ;;",
+ 'END ;;' => "END ;;\n",
+ "CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci" => "CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci",
+ "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;"=>"/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\nDELIMITER ;;"
+];
+foreach($rpline as $key => $val)
+{
+ $input=str_replace($key, $val, $input);
+}
+
+$regline=['/\/\*!50106 DROP EVENT IF EXISTS `(\w+)` \*\/;/' => 'DROP EVENT IF EXISTS `$1` ;'];
+foreach($regline as $key => $val)
+{
+ $input=preg_replace($key,$val,$input);
+}
+
+echo $input;
+
diff --git a/.github/clean_routines_sql.php b/.github/clean_routines_sql.php
new file mode 100644
index 000000000..913b863fa
--- /dev/null
+++ b/.github/clean_routines_sql.php
@@ -0,0 +1,64 @@
+ "/*!40101 SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci */;",
+ '/*!50003 CREATE*/'=>'CREATE',
+ '/*!50003 TRIGGER'=>'TRIGGER',
+ 'END */;;' => "END ;;\n",
+ 'END ;;' => "END ;;\n",
+ '/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;' => "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n/*!40101 SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci */;\nDELIMITER ;;",
+ "CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci" => "CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci"
+];
+foreach($rpline as $key => $val)
+{
+ $input=str_replace($key, $val, $input);
+}
+
+$regline=['/\/\*!50032 DROP TRIGGER IF EXISTS (\w+) \*\/;/' => 'DROP TRIGGER IF EXISTS $1 ;;'];
+foreach($regline as $key => $val)
+{
+ $input=preg_replace($key,$val,$input);
+}
+
+echo $input;
+
diff --git a/.github/clean_trigger_sql.php b/.github/clean_trigger_sql.php
new file mode 100644
index 000000000..723937be3
--- /dev/null
+++ b/.github/clean_trigger_sql.php
@@ -0,0 +1,60 @@
+ "/*!40101 SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci */;",
+ '/*!50003 CREATE*/'=>'CREATE',
+ '/*!50003 TRIGGER'=>'TRIGGER',
+ 'END */;;' => "END ;;\n",
+ '/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;' => "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\nDELIMITER ;;"
+];
+foreach($rpline as $key => $val)
+{
+ $input=str_replace($key, $val, $input);
+}
+
+$regline=['/\/\*!50032 DROP TRIGGER IF EXISTS (\w+) \*\/;/' => 'DROP TRIGGER IF EXISTS $1 ;;'];
+foreach($regline as $key => $val)
+{
+ $input=preg_replace($key,$val,$input);
+}
+
+echo $input;
+
diff --git a/backend/migrations-init/m200309_075759_populate_levels.php b/backend/migrations-init/m200309_075759_populate_levels.php
index 49f38a2fe..0102d9446 100644
--- a/backend/migrations-init/m200309_075759_populate_levels.php
+++ b/backend/migrations-init/m200309_075759_populate_levels.php
@@ -7,49 +7,48 @@
*/
class m200309_075759_populate_levels extends Migration
{
- public $experiences=[
- ['name'=>'New', 'description'=>'User just started', 'icon'=> 'default.png'],
- ['name'=>'Securitas', 'description'=>'test', 'icon'=> 'default.png'],
- ['name'=>'PenTester', 'description'=>'test', 'icon'=> 'default.png'],
- ['name'=>'CTFer', 'description'=>'test', 'icon'=> 'default.png'],
- ['name'=>'Hax0r', 'description'=>'test', 'icon'=> 'default.png'],
+ public $experiences = [
+ ['name' => 'New', 'description' => 'User just started', 'icon' => 'default.png'],
+ ['name' => 'Securitas', 'description' => 'test', 'icon' => 'default.png'],
+ ['name' => 'PenTester', 'description' => 'test', 'icon' => 'default.png'],
+ ['name' => 'CTFer', 'description' => 'test', 'icon' => 'default.png'],
+ ['name' => 'Hax0r', 'description' => 'test', 'icon' => 'default.png'],
];
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $min_points=0;
- $max_points=1000;
- $step=1000;
- $dyn=1;
- $lvl=0;
- for($i=0;$i < 20;$i++)
- {
- $xp=[];
- $xp['id']=intval($i + 1);
- $xp['name']=sprintf("%s %d", $this->experiences[$lvl]['name'], ($dyn % 5));
- $xp['category']=sprintf("%s", $this->experiences[$lvl]['name']);
- $xp['description']='autogen';
- $xp['icon']='default.png';
- $xp['min_points']=intval($min_points);
- $xp['max_points']=intval($max_points + ($step * ($i == 0 ? $i : $i + 1)));
- $this->db->createCommand()->insert('{{%experience}}', $xp)->execute();
- $max_points=$xp['max_points'];
- $min_points=$max_points + 1;
- if(($dyn % 4) == 0)
- {
-$lvl++;$dyn=0;}
- $dyn++;
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $min_points = 0;
+ $max_points = 1000;
+ $step = 1000;
+ $dyn = 1;
+ $lvl = 0;
+ for ($i = 0; $i < 20; $i++) {
+ $xp = [];
+ $xp['id'] = intval($i + 1);
+ $xp['name'] = sprintf("%s %d", $this->experiences[$lvl]['name'], ($dyn % 5));
+ $xp['category'] = sprintf("%s", $this->experiences[$lvl]['name']);
+ $xp['description'] = 'autogen';
+ $xp['icon'] = 'default.png';
+ $xp['min_points'] = intval($min_points);
+ $xp['max_points'] = intval($max_points + ($step * ($i == 0 ? $i : $i + 1)));
+ $this->upsert('{{%experience}}', $xp);
+ $max_points = $xp['max_points'];
+ $min_points = $max_points + 1;
+ if (($dyn % 4) == 0) {
+ $lvl++;
+ $dyn = 0;
}
+ $dyn++;
}
+ }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->db->createCommand()->truncateTable('{{%experience}}')->execute();
- }
-
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ $this->db->createCommand()->truncateTable('{{%experience}}')->execute();
+ }
}
diff --git a/backend/migrations-init/m200309_081940_populate_countries.php b/backend/migrations-init/m200309_081940_populate_countries.php
index 540de878d..26388af76 100644
--- a/backend/migrations-init/m200309_081940_populate_countries.php
+++ b/backend/migrations-init/m200309_081940_populate_countries.php
@@ -12,8 +12,8 @@ class m200309_081940_populate_countries extends Migration
*/
public function safeUp()
{
- $CREATE_SQL="INSERT INTO country VALUES ('UNK', 'Not set');
-INSERT INTO country VALUES ('AF','Afghanistan'),
+ $CREATE_SQL="INSERT IGNORE INTO country VALUES ('UNK', 'Not set');
+INSERT IGNORE INTO country VALUES ('AF','Afghanistan'),
('AL','Albania'),('DZ','Algeria'),('AS','American Samoa'),('AD','Andorra'),('AO','Angola'),
('AI','Anguilla'),('AQ','Antarctica'),('AG','Antigua and Barbuda'),('AR','Argentina'),
('AM','Armenia'),('AW','Aruba'),('AU','Australia'),('AT','Austria'),('AZ','Azerbaijan'),
@@ -81,8 +81,7 @@ public function safeUp()
('GB','United Kingdom'),('US','United States'),('UM','United States Minor Outlying Islands'),
('UY','Uruguay'),('UZ','Uzbekistan'),('VU','Vanuatu'),('VE','Venezuela'),('VN','Viet Nam'),
('VG','Virgin Islands, British'),('VI','Virgin Islands, U.s.'),('WF','Wallis and Futuna'),
- ('EH','Western Sahara'),('YE','Yemen'),('ZM','Zambia'),('ZW','Zimbabwe');
-";
+ ('EH','Western Sahara'),('YE','Yemen'),('ZM','Zambia'),('ZW','Zimbabwe')";
$this->db->createCommand($CREATE_SQL)->execute();
}
diff --git a/backend/migrations-init/m200309_082230_populate_avatars.php b/backend/migrations-init/m200309_082230_populate_avatars.php
index d6f27ca30..a80f23f1c 100644
--- a/backend/migrations-init/m200309_082230_populate_avatars.php
+++ b/backend/migrations-init/m200309_082230_populate_avatars.php
@@ -12,54 +12,13 @@ class m200309_082230_populate_avatars extends Migration
*/
public function safeUp()
{
- $CREATE_SQL="INSERT INTO avatar value ('256_10.png');
- INSERT INTO avatar value ('256_11.png');
- INSERT INTO avatar value ('256_12.png');
- INSERT INTO avatar value ('256_13.png');
- INSERT INTO avatar value ('256_14.png');
- INSERT INTO avatar value ('256_15.png');
- INSERT INTO avatar value ('256_16.png');
- INSERT INTO avatar value ('256_1.png');
- INSERT INTO avatar value ('256_2.png');
- INSERT INTO avatar value ('256_3.png');
- INSERT INTO avatar value ('256_4.png');
- INSERT INTO avatar value ('256_5.png');
- INSERT INTO avatar value ('256_6.png');
- INSERT INTO avatar value ('256_7.png');
- INSERT INTO avatar value ('256_8.png');
- INSERT INTO avatar value ('256_9.png');
- INSERT INTO avatar value ('avatar-1.png');
- INSERT INTO avatar value ('avatar-2.png');
- INSERT INTO avatar value ('avatar-3.png');
- INSERT INTO avatar value ('avatar-4.png');
- INSERT INTO avatar value ('avatar-5.png');
- INSERT INTO avatar value ('avatar-6.png');
- INSERT INTO avatar value ('avatar-7.png');
- INSERT INTO avatar value ('avatar-8.png');
- INSERT INTO avatar value ('Bride.png');
- INSERT INTO avatar value ('default.png');
- INSERT INTO avatar value ('Franky.png');
- INSERT INTO avatar value ('Skeleton.png');
- INSERT INTO avatar value ('users-10.svg');
- INSERT INTO avatar value ('users-11.svg');
- INSERT INTO avatar value ('users-12.svg');
- INSERT INTO avatar value ('users-13.svg');
- INSERT INTO avatar value ('users-14.svg');
- INSERT INTO avatar value ('users-15.svg');
- INSERT INTO avatar value ('users-16.svg');
- INSERT INTO avatar value ('users-1.svg');
- INSERT INTO avatar value ('users-2.svg');
- INSERT INTO avatar value ('users-3.svg');
- INSERT INTO avatar value ('users-4.svg');
- INSERT INTO avatar value ('users-5.svg');
- INSERT INTO avatar value ('users-6.svg');
- INSERT INTO avatar value ('users-7.svg');
- INSERT INTO avatar value ('users-8.svg');
- INSERT INTO avatar value ('users-9.svg');
- INSERT INTO avatar value ('Vampire-Girl.png');
- INSERT INTO avatar value ('Vampire.png');
- INSERT INTO avatar value ('Witch.png');
-";
+ $CREATE_SQL="INSERT IGNORE INTO avatar value ('256_10.png'),('256_11.png'),('256_12.png'),('256_13.png'),('256_14.png'),
+('256_15.png'),('256_16.png'), ('256_1.png'), ('256_2.png'), ('256_3.png'), ('256_4.png'), ('256_5.png'), ('256_6.png'),
+('256_7.png'), ('256_8.png'), ('256_9.png'), ('avatar-1.png'), ('avatar-2.png'), ('avatar-3.png'), ('avatar-4.png'), ('avatar-5.png'),
+('avatar-6.png'), ('avatar-7.png'), ('avatar-8.png'), ('Bride.png'), ('default.png'), ('Franky.png'),
+('Skeleton.png'), ('users-10.svg'), ('users-11.svg'), ('users-12.svg'), ('users-13.svg'), ('users-14.svg'), ('users-15.svg'),
+('users-16.svg'), ('users-1.svg'), ('users-2.svg'), ('users-3.svg'), ('users-4.svg'), ('users-5.svg'), ('users-6.svg'),
+('users-7.svg'), ('users-8.svg'), ('users-9.svg'), ('Vampire-Girl.png'), ('Vampire.png'), ('Witch.png')";
$this->db->createCommand($CREATE_SQL)->execute();
}
diff --git a/backend/migrations-init/m200309_094731_populate_hints.php b/backend/migrations-init/m200309_094731_populate_hints.php
index d40c0ae8f..bd16af92c 100644
--- a/backend/migrations-init/m200309_094731_populate_hints.php
+++ b/backend/migrations-init/m200309_094731_populate_hints.php
@@ -12,7 +12,7 @@ class m200309_094731_populate_hints extends Migration
*/
public function safeUp()
{
- $this->db->createCommand("insert into hint (id,title) values (-1,'Welcome to the gig')")->execute();
+ $this->upsert("hint",['id'=>-1,'title'=>'Welcome to the gig']);
}
diff --git a/backend/migrations-init/m211130_083724_load_params_into_sysconfig.php b/backend/migrations-init/m211130_083724_load_params_into_sysconfig.php
deleted file mode 100644
index c0b895661..000000000
--- a/backend/migrations-init/m211130_083724_load_params_into_sysconfig.php
+++ /dev/null
@@ -1,26 +0,0 @@
-params['dn'] as $key => $val)
- Yii::$app->sys->{'dn_'.$key}=$val;
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
-
- }
-}
diff --git a/backend/migrations-init/m211204_005430_load_default_email_templates.php b/backend/migrations-init/m211204_005430_load_default_email_templates.php
index 987a3ac44..8cb8c8f22 100644
--- a/backend/migrations-init/m211204_005430_load_default_email_templates.php
+++ b/backend/migrations-init/m211204_005430_load_default_email_templates.php
@@ -8,35 +8,129 @@
class m211204_005430_load_default_email_templates extends Migration
{
public $TPL=[
- 'emailChangeVerify',
- 'emailVerify',
- 'passwordResetToken',
- 'rejectVerify',
+ ['name'=>'emailChangeVerify','title'=>"emailChangeVerify",'txt'=>'
+Hello,
+
+You just requested that this email address be linked to your =Html::encode(\Yii::$app->sys->event_name)?>
+account.
+
+To verify that this email is valid follow the link below:
+
+= $verifyLink ?>
+
+If you have any difficulties, feel free to join our discord server and ask for
+assistance there.
+
+Best regards,
+
+=Html::encode(\Yii::$app->sys->event_name)?> team','html'=>'
+
+
Hello,
+
+
You just requested that this email address be linked to your =Html::encode(\Yii::$app->sys->event_name)?> account.
+
+
To verify that this email is valid follow the link below:
+
+
= Html::a(Html::encode($verifyLink), $verifyLink) ?>
+
+
If you have any difficulties, feel free to join our discord server and ask for assistance there.
+
+
Best regards,
=Html::encode(\Yii::$app->sys->event_name)?> team
+
+
'],
+ ['name'=>'emailVerify','title'=>'emailVerify','txt'=>'Hello and welcome to =\Yii::$app->sys->event_name?>
+
+You (or possibly someone else), just requested that this email address be used
+to create an account on our platform.
+
+To complete this verification process and activate the account on our platform
+follow the link below:
+
+= $verifyLink ?>
+
+If you didn\'t request the account registration, just ignore this email.','html'=>'
+
+
Hello and welcome to =Html::encode(Yii::$app->sys->event_name)?>
+
+
You (or possibly someone else), just requested that this email address be used
+to create an account on our platform.
+
+
To complete this verification process and activate the account on our platform
+follow the link below:
+
+
= Html::a(Html::encode($verifyLink), $verifyLink) ?>
+
+
If you didn\'t request the account registration, just ignore this email.
+
+
'],
+ ['name'=>'passwordResetToken','title'=>'passwordResetToken','txt'=>'Hello = $user->username ?>,
+
+You (or possibly someone else), just requested a password reset operation
+to be performed on an account associated with this email address.
+
+Follow the link below to reset your password:
+
+= $resetLink ?>
+
+If you didn\'t request this password reset, just ignore this email.','html'=>'
+
+
Hello = Html::encode($user->username) ?>,
+
+
You (or possibly someone else), just requested a password reset operation
+to be performed on an account associated with this email address.
+
+
Follow the link below to reset your password:
+
+
= Html::a(Html::encode($resetLink), $resetLink) ?>
+
+
If you didn\'t request this password reset, just ignore this email.
+
'],
+ ['name'=>'rejectVerify','title'=>'rejectVerify','txt'=>'Hello =$user->username?>,
+
+This email is to inform you that your registration for the =\Yii::$app->sys->event_name?> was rejected.
+
+If you feel this is mistake please feel free to get in touch.
+
+Thank you,
+
+the =\Yii::$app->sys->event_name?> team','html'=>'
+
+
Hello =Html::encode($user->username)?>,
+
+
This email is to inform you that your registration for the =Html::encode(\Yii::$app->sys->event_name)?> was rejected.
+
+
If you feel this is mistake please feel free to get in touch.
+
+
Thank you,
+
the =Html::encode(\Yii::$app->sys->event_name)?> team
+
'],
+ ['name'=>'pendingApproval','title'=>'pendingApproval','txt'=>'Hello,
+
+Thank you for registering to be part of the =Yii::$app->sys->event_name?>.
+
+Your registration is being validated by the organizing committee.
+
+Once your registration is successfully validated, you will receive an email with instructions to activate it.
+
+Good luck!','html'=>'
+
+
Hello,
+
Thank you for registering to be part of the =Html::encode(Yii::$app->sys->event_name)?>.
+
+
Your registration is being validated by the organizing committee.
+
Once your registration is successfully validated, you will receive an email with instructions to activate it.
+
+
Good luck!
+
'],
];
/**
* {@inheritdoc}
*/
public function safeUp()
{
- $dirn=\Yii::getAlias("@app");
foreach($this->TPL as $base)
{
- $txt=$html=null;
- try{
- $txt=file_get_contents("$dirn/../frontend/mail/".$base."-text.php");
- }
- catch(\Exception $e)
- {
- printf("Failed to store frontend mail %s\n",$e->getMessage());
- }
- try {
- $html=file_get_contents("$dirn/../frontend/mail/".$base."-html.php");
- }
- catch(\Exception $e)
- {
- printf("Failed to store frontend mail %s\n",$e->getMessage());
- }
- $this->insert('email_template',['name'=>$base,'title'=>$base,'txt'=>$txt,'html'=>$html]);
+ $this->insert('email_template',$base);
}
}
@@ -48,23 +142,8 @@ public function safeDown()
{
foreach($this->TPL as $base)
{
- $this->delete('email_template',['name'=>$base]);
+ $this->delete('email_template',['name'=>$base['name']]);
}
}
-
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
-
- }
-
- public function down()
- {
- echo "m211204_005430_load_default_email_templates cannot be reverted.\n";
-
- return false;
- }
- */
}
diff --git a/backend/migrations-init/m220102_214745_populate_url_routes.php b/backend/migrations-init/m220102_214745_populate_url_routes.php
index 71fd0749d..c70e065cd 100644
--- a/backend/migrations-init/m220102_214745_populate_url_routes.php
+++ b/backend/migrations-init/m220102_214745_populate_url_routes.php
@@ -7,103 +7,115 @@
*/
class m220102_214745_populate_url_routes extends Migration
{
- public $url_rules=[
- 'login' => 'site/login',
- 'logout' => 'site/logout',
- 'register'=>'site/register',
- 'request-password-reset'=>'site/request-password-reset',
- 'reset-password' => 'site/reset-password',
- 'resend-verification-email'=>'site/resend-verification-email',
- 'verify-email'=>'site/verify-email',
- 'changelog' => 'site/changelog',
- 'site/captcha'=>'site/captcha',
- 'dashboard' => 'dashboard/index',
- 'challenges' => 'challenge/default/index',
- 'challenge/' => 'challenge/default/view',
- 'challenge//download' => 'challenge/default/download',
- 'challenge//rate' => 'game/default/rate-solver',
- 'targets' => 'target/default/index',
- 'targets/search' => 'target/default/search',
- 'target//rate' => 'game/default/rate-headshot',
- 'target/' => 'target/default/view',
- 'target//badge' => 'target/default/badge',
- 'target//spin'=>'target/default/spin',
- 'target//spawn'=>'target/default/spawn',
- 'target//shut'=>'target/default/shut',
- 'target//writeup/read/' => 'target/writeup/read',
- 'target//writeup/rate/' => 'game/default/rate-writeup',
- 'target//writeups/enable' => 'target/writeup/enable',
- 'target//writeup/submit' => 'target/writeup/submit',
- 'target//writeup/view' => 'target/writeup/view',
- 'target//writeup/update' => 'target/writeup/update',
- 'claim'=>'target/default/claim',
- 'profile/' => 'profile/index',
- 'profile//badge' => 'profile/badge',
- 'profile//invite' => 'profile/invite',
- 'profile/me'=>'profile/me',
- 'profile/ovpn/'=>'profile/ovpn',
- 'profile/settings'=>'profile/settings',
- 'profile/revoke'=>'profile/revoke',
- 'help' => 'help/default/index',
- 'faq' => 'help/faq/index',
- 'rules' => 'help/rule/index',
- 'instructions' => 'help/instruction/index',
- 'credits' => 'help/credits/index',
- 'help/faq' => 'help/faq/index',
- 'help/rules' => 'help/rule/index',
- 'help/instructions' => 'help/instruction/index',
- 'help/experience' => 'help/experience/index',
- 'terms_and_conditions'=>'legal/terms-and-conditions',
- 'legal/terms-and-conditions'=>'legal/terms-and-conditions',
- 'privacy_policy'=>'legal/privacy-policy',
- 'legal/privacy-policy'=>'legal/privacy-policy',
- 'target//vs/'=>'target/default/versus',
- 'target//versus/'=>'target/default/versus',
- 'tutorials' => 'tutorial/default/index',
- 'tutorial/' => 'tutorial/default/view',
- 'leaderboards' => 'game/leaderboards/index',
- 'badge//headshot/' => 'game/badge/headshot',
- 'teams' => 'team/default/index',
- 'team/create' => 'team/default/create',
- 'team/update' => 'team/default/update',
- 'team/mine' => 'team/default/mine',
- 'team/' => 'team/default/view',
- 'team/join/' => 'team/default/join',
- 'team/invite/' => 'team/default/invite',
- 'team/renew/' => 'team/default/renew',
- 'team/approve/' => 'team/default/approve',
- 'team/reject/' => 'team/default/reject',
- 'networks' => 'network/default/index',
- 'network/' => 'network/default/view',
- 'api/headshots' => 'api/headshot/index',
- 'api/notification' => 'api/notification/index',
- 'subscriptions' => 'subscription/default/index',
- 'subscription/success'=>'subscription/default/success',
- 'subscription/create-checkout-session'=>'subscription/default/create-checkout-session',
- 'subscription/checkout-session'=>'subscription/default/checkout-session',
- 'subscription/customer-portal'=>'subscription/default/customer-portal',
- 'subscription/redirect-customer-portal'=>'subscription/default/redirect-customer-portal',
- 'subscription/cancel'=>'subscription/default/cancel-subscription',
- 'subscription/webhook'=>'subscription/default/webhook',
- 'subscription/inquiry'=>'subscription/default/inquiry',
- ];
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $weight=10;
- foreach($this->url_rules as $key => $val)
- $this->upsert('url_route',['source'=>$key,'destination'=>$val,'weight'=>$weight+=10]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- foreach($this->url_rules as $key => $val)
- $this->delete('url_route',['source'=>$key]);
- }
+ public $url_rules = [
+ 'login' => 'site/login',
+ 'logout' => 'site/logout',
+ 'register' => 'site/register',
+ 'request-password-reset' => 'site/request-password-reset',
+ 'reset-password' => 'site/reset-password',
+ 'resend-verification-email' => 'site/resend-verification-email',
+ 'verify-email' => 'site/verify-email',
+ 'changelog' => 'site/changelog',
+ 'site/captcha' => 'site/captcha',
+ 'dashboard' => 'dashboard/index',
+ 'challenges' => 'challenge/default/index',
+ 'challenge/' => 'challenge/default/view',
+ 'challenge//download' => 'challenge/default/download',
+ 'challenge//rate' => 'game/default/rate-solver',
+ 'targets' => 'target/default/index',
+ 'targets/search' => 'target/default/search',
+ 'target//rate' => 'game/default/rate-headshot',
+ 'target/' => 'target/default/view',
+ 'target//badge' => 'target/default/badge',
+ 'target//spin' => 'target/default/spin',
+ 'target//spawn' => 'target/default/spawn',
+ 'target//shut' => 'target/default/shut',
+ 'target//writeup/read/' => 'target/writeup/read',
+ 'target//writeup/rate/' => 'game/default/rate-writeup',
+ 'target//writeups/enable' => 'target/writeup/enable',
+ 'target//writeup/submit' => 'target/writeup/submit',
+ 'target//writeup/view' => 'target/writeup/view',
+ 'target//writeup/update' => 'target/writeup/update',
+ 'claim' => 'target/default/claim',
+ 'profile/' => 'profile/index',
+ 'profile//badge' => 'profile/badge',
+ 'profile//invite' => 'profile/invite',
+ 'profile/me' => 'profile/me',
+ 'profile/ovpn/' => 'profile/ovpn',
+ 'profile/settings' => 'profile/settings',
+ 'profile/revoke' => 'profile/revoke',
+ 'help' => 'help/default/index',
+ 'faq' => 'help/faq/index',
+ 'rules' => 'help/rule/index',
+ 'instructions' => 'help/instruction/index',
+ 'credits' => 'help/credits/index',
+ 'help/faq' => 'help/faq/index',
+ 'help/rules' => 'help/rule/index',
+ 'help/instructions' => 'help/instruction/index',
+ 'help/experience' => 'help/experience/index',
+ 'terms_and_conditions' => 'legal/terms-and-conditions',
+ 'legal/terms-and-conditions' => 'legal/terms-and-conditions',
+ 'privacy_policy' => 'legal/privacy-policy',
+ 'legal/privacy-policy' => 'legal/privacy-policy',
+ 'target//vs/' => 'target/default/versus',
+ 'target//versus/' => 'target/default/versus',
+ 'tutorials' => 'tutorial/default/index',
+ 'tutorial/' => 'tutorial/default/view',
+ 'leaderboards' => 'game/leaderboards/index',
+ 'badge//headshot/' => 'game/badge/headshot',
+ 'teams' => 'team/default/index',
+ 'team/create' => 'team/default/create',
+ 'team/update' => 'team/default/update',
+ 'team/mine' => 'team/default/mine',
+ 'team/' => 'team/default/view',
+ 'team/join/' => 'team/default/join',
+ 'team/invite/' => 'team/default/invite',
+ 'team/renew/' => 'team/default/renew',
+ 'team/approve/' => 'team/default/approve',
+ 'team/reject/' => 'team/default/reject',
+ 'networks' => 'network/default/index',
+ 'network/' => 'network/default/view',
+ 'api/headshots' => 'api/headshot/index',
+ 'api/notification' => 'api/notification/index',
+ 'subscriptions' => 'subscription/default/index',
+ 'subscription/success' => 'subscription/default/success',
+ 'subscription/create-checkout-session' => 'subscription/default/create-checkout-session',
+ 'subscription/checkout-session' => 'subscription/default/checkout-session',
+ 'subscription/customer-portal' => 'subscription/default/customer-portal',
+ 'subscription/redirect-customer-portal' => 'subscription/default/redirect-customer-portal',
+ 'subscription/cancel' => 'subscription/default/cancel-subscription',
+ 'subscription/webhook' => 'subscription/default/webhook',
+ 'subscription/inquiry' => 'subscription/default/inquiry',
+ 'profile/disconnect' => 'profile/disconnect',
+ 'profile/delete' => 'profile/delete',
+ 'profile/generate-token' => 'profile/generate-token',
+ 'api/target/claim' => 'api/target/claim',
+ 'api/target/instances' => 'api/target/instances',
+ 'api/target/' => 'api/target/view',
+ 'api/target//spin' => 'api/target/spin',
+ 'api/target//spawn' => 'api/target/spawn',
+ 'api/target//shut' => 'api/target/shut',
+ 'api/profile/me' => 'api/profile/me',
+ 'speed' => 'speedprogramming/default/index',
+ 'speed/' => 'speedprogramming/default/view',
+ 'speed//answer' => 'speedprogramming/default/answer',
+ ];
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $weight = 10;
+ foreach ($this->url_rules as $key => $val)
+ $this->upsert('url_route', ['source' => $key, 'destination' => $val, 'weight' => $weight += 10],true);
+ }
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ foreach ($this->url_rules as $key => $val)
+ $this->delete('url_route', ['source' => $key]);
+ }
}
diff --git a/backend/migrations-init/m220109_124642_populate_vpn_template.php b/backend/migrations-init/m220109_124642_populate_vpn_template.php
index f3313a345..d9057565c 100644
--- a/backend/migrations-init/m220109_124642_populate_vpn_template.php
+++ b/backend/migrations-init/m220109_124642_populate_vpn_template.php
@@ -12,7 +12,6 @@ class m220109_124642_populate_vpn_template extends Migration
'name'=> 'echoCTF',
'filename'=> 'echoCTF.ovpn',
'description' =>'echoCTF.RED OpenVPN client configuration',
- //'content' =>file_get_content('/etc/passwd'),
'active' =>1,
'visible' =>1,
'client' =>1,
@@ -35,19 +34,4 @@ public function safeDown()
{
$this->delete('{{%vpn_template}}',$this->template);
}
-
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
-
- }
-
- public function down()
- {
- echo "m220109_124642_populate_vpn_template cannot be reverted.\n";
-
- return false;
- }
- */
}
diff --git a/backend/migrations-init/m221108_233955_add_default_validator_sysconfig_keys.php b/backend/migrations-init/m221108_233955_add_default_validator_sysconfig_keys.php
deleted file mode 100644
index e45f87647..000000000
--- a/backend/migrations-init/m221108_233955_add_default_validator_sysconfig_keys.php
+++ /dev/null
@@ -1,47 +0,0 @@
- 0,
- 'verification_resend_ip_timeout'=>60*60,
- 'verification_resend_email' => 3,
- 'verification_resend_email_timeout'=>60*60,
- 'password_reset_ip' => 0,
- 'password_reset_ip_timeout'=>60*60,
- 'password_reset_email' => 3,
- 'password_reset_email_timeout'=>60*60,
- 'signup_TotalRegistrationsValidator' =>0,
- 'signup_HourRegistrationValidator' =>0,
- 'signup_StopForumSpamValidator' =>0,
- 'signup_MXServersValidator' =>0,
- 'failed_login_ip' => 0,
- 'failed_login_ip_timeout'=>15*60,
- 'failed_login_username' => 10,
- 'failed_login_username_timeout'=>15*60,
- 'username_length_min' => 4,
- 'username_length_max' => 32,
- ];
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- foreach($this->keys as $key => $val)
- $this->upsert('sysconfig',['id'=>$key,'val'=>$val],true);
- }
-
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "m221108_233955_add_default_validator_sysconfig_keys cannot be reverted.\n";
- }
-}
diff --git a/backend/migrations-init/m241102_211311_disconnect_and_delete_url_route.php b/backend/migrations-init/m241102_211311_disconnect_and_delete_url_route.php
deleted file mode 100644
index 79633dad3..000000000
--- a/backend/migrations-init/m241102_211311_disconnect_and_delete_url_route.php
+++ /dev/null
@@ -1,26 +0,0 @@
-upsert('url_route',['source'=>'profile/disconnect','destination'=>'profile/disconnect','weight'=>341],true);
- $this->upsert('url_route',['source'=>'profile/delete','destination'=>'profile/delete','weight'=>342],true);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->delete('url_route',['source'=>'profile/disconnect']);
- $this->delete('url_route',['source'=>'profile/delete']);
- }
-}
diff --git a/backend/migrations-init/m241103_021658_target_api_url_routes.php b/backend/migrations-init/m241103_021658_target_api_url_routes.php
deleted file mode 100644
index 77732847b..000000000
--- a/backend/migrations-init/m241103_021658_target_api_url_routes.php
+++ /dev/null
@@ -1,34 +0,0 @@
-upsert('url_route',['source'=>'profile/generate-token','destination'=>'profile/generate-token','weight'=>339]);
- //$this->upsert('url_route',['source'=>'api/targets','destination'=>'api/target/index','weight'=>642]);
- $this->upsert('url_route',['source'=>'api/target/claim','destination'=>'api/target/claim','weight'=>643]);
- $this->upsert('url_route',['source'=>'api/target/instances','destination'=>'api/target/instances','weight'=>643]);
- $this->upsert('url_route',['source'=>'api/target/','destination'=>'api/target/view','weight'=>644]);
- $this->upsert('url_route',['source'=>'api/target//spin','destination'=>'api/target/spin','weight'=>645]);
- $this->upsert('url_route',['source'=>'api/target//spawn','destination'=>'api/target/spawn','weight'=>646]);
- $this->upsert('url_route',['source'=>'api/target//shut','destination'=>'api/target/shut','weight'=>647]);
- $this->upsert('url_route',['source'=>'api/profile/me','destination'=>'api/profile/me','weight'=>648]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "m241103_021658_target_api_url_routes cannot be reverted.\n";
- }
-
-}
diff --git a/backend/migrations-init/m241104_211706_add_default_token_validities.php b/backend/migrations-init/m241104_211706_add_default_token_validities.php
deleted file mode 100644
index e89d1c93d..000000000
--- a/backend/migrations-init/m241104_211706_add_default_token_validities.php
+++ /dev/null
@@ -1,26 +0,0 @@
-upsert('sysconfig',['id'=>'password_reset_token_validity','val'=>'24 hour'],true);
- $this->upsert('sysconfig',['id'=>'mail_verification_token_validity','val'=>'10 day'],true);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "m241104_211706_add_default_token_validities cannot be reverted.\n";
- }
-}
diff --git a/backend/migrations-init/m241105_111349_add_speed_programming_url_routes.php b/backend/migrations-init/m241105_111349_add_speed_programming_url_routes.php
deleted file mode 100644
index b6d1d5984..000000000
--- a/backend/migrations-init/m241105_111349_add_speed_programming_url_routes.php
+++ /dev/null
@@ -1,30 +0,0 @@
-upsert('url_route', ['source' => 'speed', 'destination' => 'speedprogramming/default/index'], true);
- $this->upsert('url_route', ['source' => 'speed/', 'destination' => 'speedprogramming/default/view'], true);
- $this->upsert('url_route', ['source' => 'speed//answer', 'destination' => 'speedprogramming/default/answer'], true);
- $this->upsert('sysconfig', ['id' => 'module_speedprogramming_disabled', 'val' => 1], true);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->delete('url_route', ['source' => 'speed',]);
- $this->delete('url_route', ['source' => 'speed/']);
- $this->delete('url_route', ['source' => 'speed//answer']);
- }
-}
diff --git a/backend/migrations-init/m241106_101540_add_player_deletion_sysconfig_keys.php b/backend/migrations-init/m241106_101540_add_player_deletion_sysconfig_keys.php
deleted file mode 100644
index 89d6a1225..000000000
--- a/backend/migrations-init/m241106_101540_add_player_deletion_sysconfig_keys.php
+++ /dev/null
@@ -1,31 +0,0 @@
-upsert('sysconfig', ['id' => 'player_delete_inactive_after', 'val' => 10]);
- $this->upsert('sysconfig', ['id' => 'player_delete_deleted_after', 'val' => 30]);
- $this->upsert('sysconfig', ['id' => 'player_changed_to_deleted_after', 'val' => 10]);
- $this->upsert('sysconfig', ['id' => 'player_delete_rejected_after', 'val' => 5]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->upsert('sysconfig', ['id' => 'player_delete_inactive_after']);
- $this->upsert('sysconfig', ['id' => 'player_delete_deleted_after']);
- $this->upsert('sysconfig', ['id' => 'player_changed_to_deleted_after']);
- $this->upsert('sysconfig', ['id' => 'player_delete_rejected_after']);
- }
-}
diff --git a/backend/migrations-init/m241108_100648_populate_default_sysconfig_keys.php b/backend/migrations-init/m241108_100648_populate_default_sysconfig_keys.php
new file mode 100644
index 000000000..a39c451c5
--- /dev/null
+++ b/backend/migrations-init/m241108_100648_populate_default_sysconfig_keys.php
@@ -0,0 +1,93 @@
+1,
+ 'avatar_robohash_set'=>'set1',
+ 'award_points'=>'full',
+ 'challenge_home'=>'@web/uploads',
+ 'country_rankings'=>1,
+ 'dashboard_is_home'=>1,
+ 'default_homepage'=>'/dashboard',
+ 'disable_registration'=>0,
+ 'event_active'=>0,
+ 'failed_login_ip'=>0,
+ 'failed_login_ip_timeout'=>900,
+ 'failed_login_username'=>10,
+ 'failed_login_username_timeout'=>900,
+ 'leaderboard_show_zero'=>0,
+ 'verification_resend_ip' => 0,
+ 'verification_resend_ip_timeout' => 60 * 60,
+ 'verification_resend_email' => 3,
+ 'verification_resend_email_timeout' => 60 * 60,
+ 'password_reset_ip' => 0,
+ 'password_reset_ip_timeout' => 60 * 60,
+ 'password_reset_email' => 3,
+ 'password_reset_email_timeout' => 60 * 60,
+ 'signup_TotalRegistrationsValidator' => 0,
+ 'signup_HourRegistrationValidator' => 0,
+ 'signup_StopForumSpamValidator' => 0,
+ 'signup_MXServersValidator' => 0,
+ 'failed_login_ip' => 0,
+ 'failed_login_ip_timeout' => 15 * 60,
+ 'failed_login_username' => 10,
+ 'failed_login_username_timeout' => 15 * 60,
+ 'username_length_min' => 4,
+ 'username_length_max' => 32,
+ 'player_delete_inactive_after' => 10,
+ 'player_delete_deleted_after' => 30,
+ 'player_changed_to_deleted_after' => 10,
+ 'player_delete_rejected_after' => 5,
+ 'module_speedprogramming_disabled' => 1,
+ 'password_reset_token_validity' => '24 hour',
+ 'mail_verification_token_validity' => '10 day',
+ 'academic_grouping'=>0,
+ 'player_monthly_rankings'=>1,
+ 'online_timeout'=>900,
+ 'platform_codename'=>'Mycenae',
+ 'player_point_rankings'=>1,
+ 'player_profile'=>1,
+ 'profile_discord'=>1,
+ 'profile_echoctf'=>1,
+ 'profile_github'=>1,
+ 'profile_htb'=>0,
+ 'profile_twitch'=>1,
+ 'profile_twitter'=>1,
+ 'profile_visibility'=>'public',
+ 'profile_youtube'=>1,
+ 'require_activation'=>1,
+ 'spins_per_day'=>10,
+ 'profile_settings_fields'=>'avatar,bio,country,discord,email,fullname,github,pending_progress,twitch,twitter,username,visibility,youtube',
+ 'subscriptions_menu_show'=>0,
+ 'team_required'=>0,
+ 'teams'=>0,
+ 'time_zone'=>'UTC',
+ 'writeup_rankings'=>1,
+ ];
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ foreach (Yii::$app->params['dn'] as $key => $val)
+ Yii::$app->sys->{'dn_' . $key} = $val;
+
+ foreach ($this->keys as $key => $val)
+ $this->upsert('sysconfig', ['id' => $key, 'val' => $val]);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ foreach ($this->keys as $key => $val)
+ $this->delete('sysconfig', ['id' => $key]);
+ }
+}
diff --git a/backend/migrations/.gitkeep b/backend/migrations/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/backend/migrations/m200207_093104_version_bump_v0_10.php b/backend/migrations/m200207_093104_version_bump_v0_10.php
deleted file mode 100644
index bc3110669..000000000
--- a/backend/migrations/m200207_093104_version_bump_v0_10.php
+++ /dev/null
@@ -1,29 +0,0 @@
-update('sysconfig', ['val'=>'v0.10'], ['id'=>'platform_version']);
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.9","v0.10")')], ['id' => 'frontpage_scenario']);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->update('sysconfig', ['val'=>'v0.9'], ['id'=>'platform_version']);
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.10","v0.9")')], ['id' => 'frontpage_scenario']);
- }
-
-}
diff --git a/backend/migrations/m200207_120247_add_weight_column_to_network_target_table.php b/backend/migrations/m200207_120247_add_weight_column_to_network_target_table.php
deleted file mode 100644
index 14a7bef89..000000000
--- a/backend/migrations/m200207_120247_add_weight_column_to_network_target_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%network_target}}', 'weight', $this->smallInteger());
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%network_target}}', 'weight');
- }
-}
diff --git a/backend/migrations/m200207_135714_add_category_column_to_treasure_table.php b/backend/migrations/m200207_135714_add_category_column_to_treasure_table.php
deleted file mode 100644
index e2ef87820..000000000
--- a/backend/migrations/m200207_135714_add_category_column_to_treasure_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%treasure}}', 'category', $this->string()->notNull()->defaultValue('other'));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%treasure}}', 'category');
- }
-}
diff --git a/backend/migrations/m200207_152533_add_active_and_status_and_scheduled_at_and_icon_columns_to_network_table.php b/backend/migrations/m200207_152533_add_active_and_status_and_scheduled_at_and_icon_columns_to_network_table.php
deleted file mode 100644
index ce330563c..000000000
--- a/backend/migrations/m200207_152533_add_active_and_status_and_scheduled_at_and_icon_columns_to_network_table.php
+++ /dev/null
@@ -1,28 +0,0 @@
-addColumn('{{%network}}', 'active', $this->boolean()->defaultValue(1));
- $this->addColumn('{{%network}}', 'codename', $this->string());
- $this->addColumn('{{%network}}', 'icon', $this->string());
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%network}}', 'active');
- $this->dropColumn('{{%network}}', 'icon');
- }
-}
diff --git a/backend/migrations/m200210_162528_add_timer_and_rating_columns_to_headshot_table.php b/backend/migrations/m200210_162528_add_timer_and_rating_columns_to_headshot_table.php
deleted file mode 100644
index 31fef17b2..000000000
--- a/backend/migrations/m200210_162528_add_timer_and_rating_columns_to_headshot_table.php
+++ /dev/null
@@ -1,27 +0,0 @@
-addColumn('{{%headshot}}', 'timer', $this->bigInteger()->unsigned()->defaultValue(0));
- $this->addColumn('{{%headshot}}', 'rating', $this->smallInteger()->defaultValue(-1));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%headshot}}', 'timer');
- $this->dropColumn('{{%headshot}}', 'rating');
- }
-}
diff --git a/backend/migrations/m200210_171218_create_time_headshot_procedure.php b/backend/migrations/m200210_171218_create_time_headshot_procedure.php
deleted file mode 100644
index 8bd4011ec..000000000
--- a/backend/migrations/m200210_171218_create_time_headshot_procedure.php
+++ /dev/null
@@ -1,30 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m200518_111954_add_location_suggestion_solution_columns_to_treasure_table.php b/backend/migrations/m200518_111954_add_location_suggestion_solution_columns_to_treasure_table.php
deleted file mode 100644
index 956c49ff1..000000000
--- a/backend/migrations/m200518_111954_add_location_suggestion_solution_columns_to_treasure_table.php
+++ /dev/null
@@ -1,29 +0,0 @@
-addColumn('{{%treasure}}', 'location', $this->string(255));
- $this->addColumn('{{%treasure}}', 'suggestion', $this->text());
- $this->addColumn('{{%treasure}}', 'solution', 'LONGTEXT');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%treasure}}', 'location');
- $this->dropColumn('{{%treasure}}', 'suggestion');
- $this->dropColumn('{{%treasure}}', 'solution');
- }
-}
diff --git a/backend/migrations/m200520_100945_add_timer_column_to_target_table.php b/backend/migrations/m200520_100945_add_timer_column_to_target_table.php
deleted file mode 100644
index ac06c70aa..000000000
--- a/backend/migrations/m200520_100945_add_timer_column_to_target_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%target}}', 'timer', $this->boolean()->defaultValue(1));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%target}}', 'timer');
- }
-}
diff --git a/backend/migrations/m200529_143337_version_bump_v0_11.php b/backend/migrations/m200529_143337_version_bump_v0_11.php
deleted file mode 100644
index de9265e3c..000000000
--- a/backend/migrations/m200529_143337_version_bump_v0_11.php
+++ /dev/null
@@ -1,28 +0,0 @@
-update('sysconfig', ['val'=>'v0.11'], ['id'=>'platform_version']);
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.10","v0.11")')], ['id' => 'frontpage_scenario']);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->update('sysconfig', ['val'=>'v0.10'], ['id'=>'platform_version']);
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.11","v0.10")')], ['id' => 'frontpage_scenario']);
- }
-}
diff --git a/backend/migrations/m200609_122520_add_approved_avatar_column_to_profile_table.php b/backend/migrations/m200609_122520_add_approved_avatar_column_to_profile_table.php
deleted file mode 100644
index 470628a41..000000000
--- a/backend/migrations/m200609_122520_add_approved_avatar_column_to_profile_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%profile}}', 'approved_avatar', $this->boolean()->defaultValue(1));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%profile}}', 'approved_avatar');
- }
-}
diff --git a/backend/migrations/m200615_072016_version_bump_v0_12.php b/backend/migrations/m200615_072016_version_bump_v0_12.php
deleted file mode 100644
index d723f1f6a..000000000
--- a/backend/migrations/m200615_072016_version_bump_v0_12.php
+++ /dev/null
@@ -1,25 +0,0 @@
-update('sysconfig', ['val'=>'v0.12'], ['id'=>'platform_version']);
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.11","v0.12")')], ['id' => 'frontpage_scenario']);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->update('sysconfig', ['val'=>'v0.11'], ['id'=>'platform_version']);
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.12","v0.11")')], ['id' => 'frontpage_scenario']);
- }
-}
diff --git a/backend/migrations/m200903_172014_create_challenge_solver_table.php b/backend/migrations/m200903_172014_create_challenge_solver_table.php
deleted file mode 100644
index 2f72b6b2a..000000000
--- a/backend/migrations/m200903_172014_create_challenge_solver_table.php
+++ /dev/null
@@ -1,94 +0,0 @@
-createTable('{{%challenge_solver}}', [
- 'challenge_id' => $this->integer()->notNull(),
- 'player_id' => $this->integer()->notNull()->unsigned(),
- 'timer' => $this->bigInteger(),
- 'rating' => $this->integer(),
- 'created_at' => $this->datetime(),
- ]);
- $this->addPrimaryKey('challenge_solver_pk', '{{%challenge_solver}}', ['challenge_id', 'player_id']);
-
- // creates index for column `challenge_id`
- $this->createIndex(
- '{{%idx-challenge_solver-challenge_id}}',
- '{{%challenge_solver}}',
- 'challenge_id'
- );
-
- // add foreign key for table `{{%challenge}}`
- $this->addForeignKey(
- '{{%fk-challenge_solver-challenge_id}}',
- '{{%challenge_solver}}',
- 'challenge_id',
- '{{%challenge}}',
- 'id',
- 'CASCADE'
- );
-
- // creates index for column `player_id`
- $this->createIndex(
- '{{%idx-challenge_solver-player_id}}',
- '{{%challenge_solver}}',
- 'player_id'
- );
-
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-challenge_solver-player_id}}',
- '{{%challenge_solver}}',
- 'player_id',
- '{{%player}}',
- 'id',
- 'CASCADE'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- // drops foreign key for table `{{%challenge}}`
- $this->dropForeignKey(
- '{{%fk-challenge_solver-challenge_id}}',
- '{{%challenge_solver}}'
- );
-
- // drops index for column `challenge_id`
- $this->dropIndex(
- '{{%idx-challenge_solver-challenge_id}}',
- '{{%challenge_solver}}'
- );
-
- // drops foreign key for table `{{%player}}`
- $this->dropForeignKey(
- '{{%fk-challenge_solver-player_id}}',
- '{{%challenge_solver}}'
- );
-
- // drops index for column `player_id`
- $this->dropIndex(
- '{{%idx-challenge_solver-player_id}}',
- '{{%challenge_solver}}'
- );
-
- $this->dropTable('{{%challenge_solver}}');
- }
-}
diff --git a/backend/migrations/m200903_174242_update_tai_player_question_trigger.php b/backend/migrations/m200903_174242_update_tai_player_question_trigger.php
deleted file mode 100644
index 16bb1d2b1..000000000
--- a/backend/migrations/m200903_174242_update_tai_player_question_trigger.php
+++ /dev/null
@@ -1,55 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($CREATE_SQL)->execute();
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- return true;
- }
-}
diff --git a/backend/migrations/m200903_195125_add_unique_index_on_player_question_table.php b/backend/migrations/m200903_195125_add_unique_index_on_player_question_table.php
deleted file mode 100644
index 576c85c9e..000000000
--- a/backend/migrations/m200903_195125_add_unique_index_on_player_question_table.php
+++ /dev/null
@@ -1,34 +0,0 @@
-createIndex(
- '{{%uidx-player_question-player_id-question_id}}',
- '{{%player_question}}',
- 'question_id,player_id',
- 1
- );
-
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropIndex('{{%uidx-player_question-player_id-question_id}}');
- }
-
-}
diff --git a/backend/migrations/m200903_205353_create_give_challenge_solver_procedure.php b/backend/migrations/m200903_205353_create_give_challenge_solver_procedure.php
deleted file mode 100644
index 5071b46ba..000000000
--- a/backend/migrations/m200903_205353_create_give_challenge_solver_procedure.php
+++ /dev/null
@@ -1,38 +0,0 @@
-0 THEN
- INSERT INTO stream (player_id,model,model_id,points,title,message,pubtitle,pubmessage,ts) VALUES (pid,'challenge',tid,0,'','','','',max_val);
- END IF;
- END IF;
-
- END";
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m200903_220735_create_give_all_challenge_solver_procedure.php b/backend/migrations/m200903_220735_create_give_all_challenge_solver_procedure.php
deleted file mode 100644
index 88836068e..000000000
--- a/backend/migrations/m200903_220735_create_give_all_challenge_solver_procedure.php
+++ /dev/null
@@ -1,39 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m200905_190000_create_player_country_rank_table.php b/backend/migrations/m200905_190000_create_player_country_rank_table.php
deleted file mode 100644
index cb34f2e0a..000000000
--- a/backend/migrations/m200905_190000_create_player_country_rank_table.php
+++ /dev/null
@@ -1,63 +0,0 @@
-createTable('{{%player_country_rank}}', [
- 'id' => $this->integer()->notNull()->defaultValue(0),
- 'player_id' => $this->integer()->unsigned()->notNull(),
- 'country' => $this->string(3)->notNull(),
- ],'ENGINE=MEMORY');
- $this->addPrimaryKey('{{%PK-player_country_rank}}', '{{%player_country_rank}}', ['id', 'country']);
-
- // creates index for column `player_id`
- $this->createIndex(
- '{{%idx-player_country_rank-player_id}}',
- '{{%player_country_rank}}',
- 'player_id',
- true
- );
-
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-player_country_rank-player_id}}',
- '{{%player_country_rank}}',
- 'player_id',
- '{{%player}}',
- 'id',
- 'CASCADE'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function down()
- {
- // drops foreign key for table `{{%player}}`
- $this->dropForeignKey(
- '{{%fk-player_country_rank-player_id}}',
- '{{%player_country_rank}}'
- );
-
- // drops index for column `player_id`
- $this->dropIndex(
- '{{%idx-player_country_rank-player_id}}',
- '{{%player_country_rank}}'
- );
-
- $this->dropTable('{{%player_country_rank}}');
- }
-}
diff --git a/backend/migrations/m200905_191807_create_calculate_country_rank_procedure.php b/backend/migrations/m200905_191807_create_calculate_country_rank_procedure.php
deleted file mode 100644
index 727407273..000000000
--- a/backend/migrations/m200905_191807_create_calculate_country_rank_procedure.php
+++ /dev/null
@@ -1,48 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m200906_195924_create_writeup_table.php b/backend/migrations/m200906_195924_create_writeup_table.php
deleted file mode 100644
index 88a8d90fc..000000000
--- a/backend/migrations/m200906_195924_create_writeup_table.php
+++ /dev/null
@@ -1,97 +0,0 @@
-createTable('{{%writeup}}', [
- 'player_id' => $this->integer()->unsigned()->notNull(),
- 'target_id' => $this->integer()->notNull(),
- 'content' => 'LONGBLOB',
- 'approved' => $this->boolean()->defaultValue(0),
- 'status' => "ENUM('PENDING','NEEDS FIXES','REJECTED','OK')",
- 'comment' => 'LONGBLOB',
- 'created_at' => $this->dateTime(),
- 'updated_at' => $this->dateTime(),
- ]);
- $this->addPrimaryKey('{{%PK-writeup}}', '{{%writeup}}', ['player_id', 'target_id']);
-
- // creates index for column `player_id`
- $this->createIndex(
- '{{%idx-writeup-player_id}}',
- '{{%writeup}}',
- 'player_id'
- );
-
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-writeup-player_id}}',
- '{{%writeup}}',
- 'player_id',
- '{{%player}}',
- 'id',
- 'CASCADE'
- );
-
- // creates index for column `target_id`
- $this->createIndex(
- '{{%idx-writeup-target_id}}',
- '{{%writeup}}',
- 'target_id'
- );
-
- // add foreign key for table `{{%target}}`
- $this->addForeignKey(
- '{{%fk-writeup-target_id}}',
- '{{%writeup}}',
- 'target_id',
- '{{%target}}',
- 'id',
- 'CASCADE'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function down()
- {
- // drops foreign key for table `{{%player}}`
- $this->dropForeignKey(
- '{{%fk-writeup-player_id}}',
- '{{%writeup}}'
- );
-
- // drops index for column `player_id`
- $this->dropIndex(
- '{{%idx-writeup-player_id}}',
- '{{%writeup}}'
- );
-
- // drops foreign key for table `{{%target}}`
- $this->dropForeignKey(
- '{{%fk-writeup-target_id}}',
- '{{%writeup}}'
- );
-
- // drops index for column `target_id`
- $this->dropIndex(
- '{{%idx-writeup-target_id}}',
- '{{%writeup}}'
- );
-
- $this->dropTable('{{%writeup}}');
- }
-}
diff --git a/backend/migrations/m200906_200758_create_player_target_help_table.php b/backend/migrations/m200906_200758_create_player_target_help_table.php
deleted file mode 100644
index 4a013c5f9..000000000
--- a/backend/migrations/m200906_200758_create_player_target_help_table.php
+++ /dev/null
@@ -1,92 +0,0 @@
-createTable('{{%player_target_help}}', [
- 'player_id' => $this->integer()->unsigned()->notNull(),
- 'target_id' => $this->integer()->notNull(),
- 'created_at' => $this->dateTime(),
- ]);
- $this->addPrimaryKey('{{%PK-player_target_help}}', '{{%player_target_help}}', ['player_id', 'target_id']);
-
- // creates index for column `player_id`
- $this->createIndex(
- '{{%idx-player_target_help-player_id}}',
- '{{%player_target_help}}',
- 'player_id'
- );
-
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-player_target_help-player_id}}',
- '{{%player_target_help}}',
- 'player_id',
- '{{%player}}',
- 'id',
- 'CASCADE'
- );
-
- // creates index for column `target_id`
- $this->createIndex(
- '{{%idx-player_target_help-target_id}}',
- '{{%player_target_help}}',
- 'target_id'
- );
-
- // add foreign key for table `{{%target}}`
- $this->addForeignKey(
- '{{%fk-player_target_help-target_id}}',
- '{{%player_target_help}}',
- 'target_id',
- '{{%target}}',
- 'id',
- 'CASCADE'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- // drops foreign key for table `{{%player}}`
- $this->dropForeignKey(
- '{{%fk-player_target_help-player_id}}',
- '{{%player_target_help}}'
- );
-
- // drops index for column `player_id`
- $this->dropIndex(
- '{{%idx-player_target_help-player_id}}',
- '{{%player_target_help}}'
- );
-
- // drops foreign key for table `{{%target}}`
- $this->dropForeignKey(
- '{{%fk-player_target_help-target_id}}',
- '{{%player_target_help}}'
- );
-
- // drops index for column `target_id`
- $this->dropIndex(
- '{{%idx-player_target_help-target_id}}',
- '{{%player_target_help}}'
- );
-
- $this->dropTable('{{%player_target_help}}');
- }
-}
diff --git a/backend/migrations/m200912_221826_version_bump_v0_13.php b/backend/migrations/m200912_221826_version_bump_v0_13.php
deleted file mode 100644
index 64bf3f270..000000000
--- a/backend/migrations/m200912_221826_version_bump_v0_13.php
+++ /dev/null
@@ -1,25 +0,0 @@
-update('sysconfig', ['val'=>'v0.13'], ['id'=>'platform_version']);
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.12","v0.13")')], ['id' => 'frontpage_scenario']);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->update('sysconfig', ['val'=>'v0.12'], ['id'=>'platform_version']);
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.13","v0.12")')], ['id' => 'frontpage_scenario']);
- }
-}
diff --git a/backend/migrations/m201012_104559_fix_calculate_country_rank_procedure.php b/backend/migrations/m201012_104559_fix_calculate_country_rank_procedure.php
deleted file mode 100644
index 0e8c6f6d1..000000000
--- a/backend/migrations/m201012_104559_fix_calculate_country_rank_procedure.php
+++ /dev/null
@@ -1,48 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201016_084541_create_devnull_table.php b/backend/migrations/m201016_084541_create_devnull_table.php
deleted file mode 100644
index a700aa929..000000000
--- a/backend/migrations/m201016_084541_create_devnull_table.php
+++ /dev/null
@@ -1,27 +0,0 @@
-createTable('{{%devnull}}', [
- 'silence' => 'BLOB',
- ],'ENGINE BLACKHOLE');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%devnull}}');
- }
-}
diff --git a/backend/migrations/m201016_222739_create_populate_memcache_procedure.php b/backend/migrations/m201016_222739_create_populate_memcache_procedure.php
deleted file mode 100644
index 7f177259c..000000000
--- a/backend/migrations/m201016_222739_create_populate_memcache_procedure.php
+++ /dev/null
@@ -1,35 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201016_222754_create_init_mysql_procedure.php b/backend/migrations/m201016_222754_create_init_mysql_procedure.php
deleted file mode 100644
index 66645a016..000000000
--- a/backend/migrations/m201016_222754_create_init_mysql_procedure.php
+++ /dev/null
@@ -1,28 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201024_223309_add_youtube_column_twitch_column_to_profile_table.php b/backend/migrations/m201024_223309_add_youtube_column_twitch_column_to_profile_table.php
deleted file mode 100644
index c8cb6a4a8..000000000
--- a/backend/migrations/m201024_223309_add_youtube_column_twitch_column_to_profile_table.php
+++ /dev/null
@@ -1,27 +0,0 @@
-addColumn('{{%profile}}', 'youtube', $this->string());
- $this->addColumn('{{%profile}}', 'twitch', $this->string());
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%profile}}', 'youtube');
- $this->dropColumn('{{%profile}}', 'twitch');
- }
-}
diff --git a/backend/migrations/m201026_115007_add_active_column_to_challenge_table.php b/backend/migrations/m201026_115007_add_active_column_to_challenge_table.php
deleted file mode 100644
index 43b2c1dbd..000000000
--- a/backend/migrations/m201026_115007_add_active_column_to_challenge_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%challenge}}', 'active', $this->boolean()->defaultValue(1));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%challenge}}', 'active');
- }
-}
diff --git a/backend/migrations/m201026_122538_add_weight_column_to_treasure_table.php b/backend/migrations/m201026_122538_add_weight_column_to_treasure_table.php
deleted file mode 100644
index 427496f4c..000000000
--- a/backend/migrations/m201026_122538_add_weight_column_to_treasure_table.php
+++ /dev/null
@@ -1,35 +0,0 @@
-addColumn('{{%treasure}}', 'weight', $this->integer()->defaultValue(0));
- $this->createIndex(
- 'idx-treasure-weight',
- '{{%treasure}}',
- 'weight'
- );
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropIndex(
- 'idx-treasure-weight',
- '{{%treasure}}'
- );
- $this->dropColumn('{{%treasure}}', 'weight');
- }
-}
diff --git a/backend/migrations/m201029_093046_add_icon_column_to_challenge_table.php b/backend/migrations/m201029_093046_add_icon_column_to_challenge_table.php
deleted file mode 100644
index 005121f11..000000000
--- a/backend/migrations/m201029_093046_add_icon_column_to_challenge_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%challenge}}', 'icon', $this->string());
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%challenge}}', 'icon');
- }
-}
diff --git a/backend/migrations/m201102_075616_add_timer_column_to_challenge_table.php b/backend/migrations/m201102_075616_add_timer_column_to_challenge_table.php
deleted file mode 100644
index 2dc9de7cf..000000000
--- a/backend/migrations/m201102_075616_add_timer_column_to_challenge_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%challenge}}', 'timer', $this->boolean()->defaultValue(1));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%challenge}}', 'timer');
- }
-}
diff --git a/backend/migrations/m201109_215335_add_ts_column_to_team_score_table.php b/backend/migrations/m201109_215335_add_ts_column_to_team_score_table.php
deleted file mode 100644
index e91dc8e7f..000000000
--- a/backend/migrations/m201109_215335_add_ts_column_to_team_score_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%team_score}}', 'ts', $this->timestamp());
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%team_score}}', 'ts');
- }
-}
diff --git a/backend/migrations/m201109_215525_create_team_rank_table.php b/backend/migrations/m201109_215525_create_team_rank_table.php
deleted file mode 100644
index d643e721d..000000000
--- a/backend/migrations/m201109_215525_create_team_rank_table.php
+++ /dev/null
@@ -1,35 +0,0 @@
-createTable('{{%team_rank}}', [
- 'id' => $this->integer()->notNull()->defaultValue(0),
- 'team_id' => $this->integer()->notNull()->unique(),
- ],'ENGINE MEMORY');
- $this->addPrimaryKey('team_rank-pk', '{{%team_rank}}', ['id', 'team_id']);
- $this->createIndex(
- 'idx-team_rank-team_id',
- '{{%team_rank}}',
- 'team_id'
- );
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%team_rank}}');
- }
-}
diff --git a/backend/migrations/m201109_221657_create_tad_team_trigger.php b/backend/migrations/m201109_221657_create_tad_team_trigger.php
deleted file mode 100644
index e81fe1f2c..000000000
--- a/backend/migrations/m201109_221657_create_tad_team_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201109_225939_create_junction_table_for_team_and_stream_tables.php b/backend/migrations/m201109_225939_create_junction_table_for_team_and_stream_tables.php
deleted file mode 100644
index 59c7abad7..000000000
--- a/backend/migrations/m201109_225939_create_junction_table_for_team_and_stream_tables.php
+++ /dev/null
@@ -1,70 +0,0 @@
-createTable('{{%team_stream}}', [
- 'team_id' => $this->integer()->notNull(),
- 'model'=>$this->string(255)->append('CHARACTER SET utf8 COLLATE utf8_bin'),
- 'model_id'=>$this->integer()->defaultValue(null),
- 'points'=>$this->float()->notNull()->defaultValue(0),
- 'ts'=>$this->timestamp(),
- 'PRIMARY KEY(team_id, model, model_id)',
- ]);
-
- $this->createIndex(
- '{{%idx-team_stream-team_id}}',
- '{{%team_stream}}',
- 'team_id'
- );
-
- $this->createIndex(
- '{{%idx-team_stream-model}}',
- '{{%team_stream}}',
- 'model'
- );
-
- $this->createIndex(
- '{{%idx-team_stream-model_id}}',
- '{{%team_stream}}',
- 'model_id'
- );
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- // drops index for column `team_id`
- $this->dropIndex(
- '{{%idx-team_stream-team_id}}',
- '{{%team_stream}}'
- );
- $this->dropIndex(
- '{{%idx-team_stream-model}}',
- '{{%team_stream}}'
- );
-
- $this->dropIndex(
- '{{%idx-team_stream-model_id}}',
- '{{%team_stream}}'
- );
-
- $this->dropTable('{{%team_stream}}');
- }
-}
diff --git a/backend/migrations/m201109_230521_update_tai_stream_trigger.php b/backend/migrations/m201109_230521_update_tai_stream_trigger.php
deleted file mode 100644
index d80a5c7df..000000000
--- a/backend/migrations/m201109_230521_update_tai_stream_trigger.php
+++ /dev/null
@@ -1,35 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201109_231732_create_tai_team_stream_trigger.php b/backend/migrations/m201109_231732_create_tai_team_stream_trigger.php
deleted file mode 100644
index 4905b25b8..000000000
--- a/backend/migrations/m201109_231732_create_tai_team_stream_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201110_011402_create_calculate_team_ranks_procedure.php b/backend/migrations/m201110_011402_create_calculate_team_ranks_procedure.php
deleted file mode 100644
index 3175e9386..000000000
--- a/backend/migrations/m201110_011402_create_calculate_team_ranks_procedure.php
+++ /dev/null
@@ -1,33 +0,0 @@
-0 AND (SELECT val FROM sysconfig WHERE id='teams')=1 THEN
- CREATE TEMPORARY TABLE `ranking` (id int primary key AUTO_INCREMENT,team_id int) ENGINE=MEMORY;
- START TRANSACTION;
- insert into ranking select NULL,t.team_id from team_score as t left join team as t2 on t.team_id=t2.id order by points desc,t.ts asc, t.team_id asc;
- insert into team_rank select * from ranking ON DUPLICATE KEY UPDATE id=values(id);
- COMMIT;
- DROP TABLE `ranking`;
- END IF;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201110_011842_create_repopulate_team_stream_procedure.php b/backend/migrations/m201110_011842_create_repopulate_team_stream_procedure.php
deleted file mode 100644
index 403acf900..000000000
--- a/backend/migrations/m201110_011842_create_repopulate_team_stream_procedure.php
+++ /dev/null
@@ -1,38 +0,0 @@
-0 AND (SELECT val FROM sysconfig WHERE id='teams')=1 THEN
- START TRANSACTION;
- UPDATE team_score SET points=0 WHERE team_id=tid;
- DELETE FROM team_stream WHERE team_id=tid;
- INSERT INTO team_stream SELECT tid,model,model_id,points,ts FROM stream WHERE model!='user' AND player_id IN (select player_id FROM team_player WHERE team_id=tid) GROUP BY model,model_id ORDER BY id,ts;
- IF `_rollback` THEN
- ROLLBACK;
- ELSE
- COMMIT;
- END IF;
- END IF;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201110_012506_update_init_mysql_procedure.php b/backend/migrations/m201110_012506_update_init_mysql_procedure.php
deleted file mode 100644
index c13c5bf42..000000000
--- a/backend/migrations/m201110_012506_update_init_mysql_procedure.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201110_013115_drop_update_player_ranks_event.php b/backend/migrations/m201110_013115_drop_update_player_ranks_event.php
deleted file mode 100644
index 91a6867d3..000000000
--- a/backend/migrations/m201110_013115_drop_update_player_ranks_event.php
+++ /dev/null
@@ -1,20 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201110_013249_create_update_ranks_event.php b/backend/migrations/m201110_013249_create_update_ranks_event.php
deleted file mode 100644
index 276dcefb5..000000000
--- a/backend/migrations/m201110_013249_create_update_ranks_event.php
+++ /dev/null
@@ -1,30 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201212_160200_add_points_column_to_player_finding_table.php b/backend/migrations/m201212_160200_add_points_column_to_player_finding_table.php
deleted file mode 100644
index 67cfa43ef..000000000
--- a/backend/migrations/m201212_160200_add_points_column_to_player_finding_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%player_finding}}', 'points', $this->float());
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%player_finding}}', 'points');
- }
-}
diff --git a/backend/migrations/m201212_160249_add_points_column_to_player_treasure_table.php b/backend/migrations/m201212_160249_add_points_column_to_player_treasure_table.php
deleted file mode 100644
index f0e82d1c4..000000000
--- a/backend/migrations/m201212_160249_add_points_column_to_player_treasure_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%player_treasure}}', 'points', $this->float());
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%player_treasure}}', 'points');
- }
-}
diff --git a/backend/migrations/m201213_130151_update_add_treasure_stream_procedure.php b/backend/migrations/m201213_130151_update_add_treasure_stream_procedure.php
deleted file mode 100644
index 9e339d577..000000000
--- a/backend/migrations/m201213_130151_update_add_treasure_stream_procedure.php
+++ /dev/null
@@ -1,32 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201213_130240_update_tai_player_treasure_trigger.php b/backend/migrations/m201213_130240_update_tai_player_treasure_trigger.php
deleted file mode 100644
index f454cbb76..000000000
--- a/backend/migrations/m201213_130240_update_tai_player_treasure_trigger.php
+++ /dev/null
@@ -1,46 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201213_200751_update_add_finding_stream_procedure.php b/backend/migrations/m201213_200751_update_add_finding_stream_procedure.php
deleted file mode 100644
index 23105ec53..000000000
--- a/backend/migrations/m201213_200751_update_add_finding_stream_procedure.php
+++ /dev/null
@@ -1,30 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201213_201050_update_tai_player_finding_trigger.php b/backend/migrations/m201213_201050_update_tai_player_finding_trigger.php
deleted file mode 100644
index f76160bb7..000000000
--- a/backend/migrations/m201213_201050_update_tai_player_finding_trigger.php
+++ /dev/null
@@ -1,50 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201213_204519_create_tbi_player_finding_trigger.php b/backend/migrations/m201213_204519_create_tbi_player_finding_trigger.php
deleted file mode 100644
index 110057e15..000000000
--- a/backend/migrations/m201213_204519_create_tbi_player_finding_trigger.php
+++ /dev/null
@@ -1,35 +0,0 @@
-0 THEN
- SET NEW.points=NEW.points/2;
- END IF;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201213_211008_create_tbi_player_treasure_trigger.php b/backend/migrations/m201213_211008_create_tbi_player_treasure_trigger.php
deleted file mode 100644
index aae985381..000000000
--- a/backend/migrations/m201213_211008_create_tbi_player_treasure_trigger.php
+++ /dev/null
@@ -1,35 +0,0 @@
-0 THEN
- SET NEW.points=NEW.points/2;
- END IF;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m201216_233752_version_bump_v0_15.php b/backend/migrations/m201216_233752_version_bump_v0_15.php
deleted file mode 100644
index 909b7ee0f..000000000
--- a/backend/migrations/m201216_233752_version_bump_v0_15.php
+++ /dev/null
@@ -1,25 +0,0 @@
-db->createCommand("INSERT INTO sysconfig (id,val) values ('platform_version','v0.15') ON DUPLICATE KEY UPDATE val=values(val)")->execute();
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.13","v0.15")')], ['id' => 'frontpage_scenario']);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->db->createCommand("INSERT INTO sysconfig (id,val) values ('platform_version','v0.14') ON DUPLICATE KEY UPDATE val=values(val)")->execute();
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.15","v0.13")')], ['id' => 'frontpage_scenario']);
- }
-}
diff --git a/backend/migrations/m210112_181424_update_calculate_ranks_procedure.php b/backend/migrations/m210112_181424_update_calculate_ranks_procedure.php
deleted file mode 100644
index 12c1b7289..000000000
--- a/backend/migrations/m210112_181424_update_calculate_ranks_procedure.php
+++ /dev/null
@@ -1,32 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m210112_181440_update_calculate_country_rank_procedure.php b/backend/migrations/m210112_181440_update_calculate_country_rank_procedure.php
deleted file mode 100644
index 8db37640f..000000000
--- a/backend/migrations/m210112_181440_update_calculate_country_rank_procedure.php
+++ /dev/null
@@ -1,48 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m210112_211036_add_first_column_to_headshot_table.php b/backend/migrations/m210112_211036_add_first_column_to_headshot_table.php
deleted file mode 100644
index 5184a631d..000000000
--- a/backend/migrations/m210112_211036_add_first_column_to_headshot_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%headshot}}', 'first', $this->boolean()->defaultValue(0));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%headshot}}', 'first');
- }
-}
diff --git a/backend/migrations/m210112_211428_create_tbi_headshot_trigger.php b/backend/migrations/m210112_211428_create_tbi_headshot_trigger.php
deleted file mode 100644
index 76b71631f..000000000
--- a/backend/migrations/m210112_211428_create_tbi_headshot_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m210114_095633_add_first_column_to_challenge_solver_table.php b/backend/migrations/m210114_095633_add_first_column_to_challenge_solver_table.php
deleted file mode 100644
index 2e0d583ae..000000000
--- a/backend/migrations/m210114_095633_add_first_column_to_challenge_solver_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%challenge_solver}}', 'first', $this->boolean()->defaultValue(0));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%challenge_solver}}', 'first');
- }
-}
diff --git a/backend/migrations/m210114_095711_create_tbi_challenge_solver_trigger.php b/backend/migrations/m210114_095711_create_tbi_challenge_solver_trigger.php
deleted file mode 100644
index 10e1ff5f6..000000000
--- a/backend/migrations/m210114_095711_create_tbi_challenge_solver_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m210114_121019_alter_rating_default_value_on_challenge_solver_table.php b/backend/migrations/m210114_121019_alter_rating_default_value_on_challenge_solver_table.php
deleted file mode 100644
index e8a2da72e..000000000
--- a/backend/migrations/m210114_121019_alter_rating_default_value_on_challenge_solver_table.php
+++ /dev/null
@@ -1,28 +0,0 @@
-alterColumn('challenge_solver', 'rating', $this->smallInteger()->notNull()->defaultValue(-1));
- $this->update('challenge_solver',['rating'=>-1]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->alterColumn('challenge_solver', 'rating', $this->integer());
- $this->update('challenge_solver',['rating'=>null]);
-
- }
-}
diff --git a/backend/migrations/m210119_125422_create_target_ondemand_table.php b/backend/migrations/m210119_125422_create_target_ondemand_table.php
deleted file mode 100644
index 3bfb7ac50..000000000
--- a/backend/migrations/m210119_125422_create_target_ondemand_table.php
+++ /dev/null
@@ -1,94 +0,0 @@
-createTable('{{%target_ondemand}}', [
- 'target_id' => $this->integer()->notNull(),
- 'player_id' => $this->integer()->unsigned(),
- 'state' => $this->tinyInteger()->notNull()->defaultValue(-1),
- 'heartbeat' => $this->datetime(),
- 'created_at' => $this->datetime(),
- 'updated_at' => $this->datetime(),
- ]);
- $this->addPrimaryKey ( 'pidPK', '{{%target_ondemand}}', 'target_id' );
- // creates index for column `target_id`
- $this->createIndex(
- '{{%idx-target_ondemand-target_id}}',
- '{{%target_ondemand}}',
- 'target_id'
- );
-
- // add foreign key for table `{{%target}}`
- $this->addForeignKey(
- '{{%fk-target_ondemand-target_id}}',
- '{{%target_ondemand}}',
- 'target_id',
- '{{%target}}',
- 'id',
- 'CASCADE'
- );
-
- // creates index for column `player_id`
- $this->createIndex(
- '{{%idx-target_ondemand-player_id}}',
- '{{%target_ondemand}}',
- 'player_id'
- );
-
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-target_ondemand-player_id}}',
- '{{%target_ondemand}}',
- 'player_id',
- '{{%player}}',
- 'id',
- 'SET NULL'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- // drops foreign key for table `{{%target}}`
- $this->dropForeignKey(
- '{{%fk-target_ondemand-target_id}}',
- '{{%target_ondemand}}'
- );
-
- // drops index for column `target_id`
- $this->dropIndex(
- '{{%idx-target_ondemand-target_id}}',
- '{{%target_ondemand}}'
- );
-
- // drops foreign key for table `{{%player}}`
- $this->dropForeignKey(
- '{{%fk-target_ondemand-player_id}}',
- '{{%target_ondemand}}'
- );
-
- // drops index for column `player_id`
- $this->dropIndex(
- '{{%idx-target_ondemand-player_id}}',
- '{{%target_ondemand}}'
- );
-
- $this->dropTable('{{%target_ondemand}}');
- }
-}
diff --git a/backend/migrations/m210119_211722_add_formatter_column_to_writeup_table.php b/backend/migrations/m210119_211722_add_formatter_column_to_writeup_table.php
deleted file mode 100644
index 24c8f8aca..000000000
--- a/backend/migrations/m210119_211722_add_formatter_column_to_writeup_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%writeup}}', 'formatter', $this->string()->notNull()->defaultValue('text'));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%writeup}}', 'formatter');
- }
-}
diff --git a/backend/migrations/m210204_125000_add_weight_column_to_network_table.php b/backend/migrations/m210204_125000_add_weight_column_to_network_table.php
deleted file mode 100644
index abf31e5e6..000000000
--- a/backend/migrations/m210204_125000_add_weight_column_to_network_table.php
+++ /dev/null
@@ -1,30 +0,0 @@
-addColumn('{{%network}}', 'weight', $this->integer()->notNull()->defaultValue(0));
- $this->createIndex(
- '{{%idx-network-weight}}',
- '{{%network}}',
- 'weight'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%network}}', 'weight');
- }
-}
diff --git a/backend/migrations/m210210_203805_add_public_column_to_challenge_table.php b/backend/migrations/m210210_203805_add_public_column_to_challenge_table.php
deleted file mode 100644
index 30ae26cbb..000000000
--- a/backend/migrations/m210210_203805_add_public_column_to_challenge_table.php
+++ /dev/null
@@ -1,30 +0,0 @@
-addColumn('{{%challenge}}', 'public', $this->boolean()->notNull()->defaultValue(1));
- $this->createIndex(
- '{{%idx-challenge-public}}',
- '{{%challenge}}',
- 'public'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%challenge}}', 'public');
- }
-}
diff --git a/backend/migrations/m210210_204804_add_perday_column_to_player_spin_table.php b/backend/migrations/m210210_204804_add_perday_column_to_player_spin_table.php
deleted file mode 100644
index 320de53e2..000000000
--- a/backend/migrations/m210210_204804_add_perday_column_to_player_spin_table.php
+++ /dev/null
@@ -1,26 +0,0 @@
-addColumn('{{%player_spin}}', 'perday', $this->tinyInteger());
- $this->db->createCommand("UPDATE player_spin SET perday=(select val from sysconfig where id='spins_per_day')")->execute();
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%player_spin}}', 'perday');
- }
-}
diff --git a/backend/migrations/m210210_205759_update_tai_player_trigger.php b/backend/migrations/m210210_205759_update_tai_player_trigger.php
deleted file mode 100644
index 1b298bb0f..000000000
--- a/backend/migrations/m210210_205759_update_tai_player_trigger.php
+++ /dev/null
@@ -1,40 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m210213_145213_create_inquiry_table.php b/backend/migrations/m210213_145213_create_inquiry_table.php
deleted file mode 100644
index 2bd707ec7..000000000
--- a/backend/migrations/m210213_145213_create_inquiry_table.php
+++ /dev/null
@@ -1,68 +0,0 @@
-createTable('{{%inquiry}}', [
- 'id' => $this->primaryKey(),
- 'player_id' => $this->integer()->unsigned()->notNull(),
- 'answered'=>$this->boolean()->notNull()->defaultValue(0),
- 'category' => $this->string()->defaultValue('contact'),
- 'name' => $this->string(),
- 'email' => $this->string(),
- 'serialized' => $this->text(),
- 'body'=>$this->text(),
- 'updated_at'=>$this->timestamp()->notNull(),
- 'created_at'=>$this->datetime(),
- ]);
-
- // creates index for column `player_id`
- $this->createIndex(
- '{{%idx-inquiry-player_id}}',
- '{{%inquiry}}',
- 'player_id'
- );
-
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-inquiry-player_id}}',
- '{{%inquiry}}',
- 'player_id',
- '{{%player}}',
- 'id',
- 'CASCADE'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- // drops foreign key for table `{{%player}}`
- $this->dropForeignKey(
- '{{%fk-inquiry-player_id}}',
- '{{%inquiry}}'
- );
-
- // drops index for column `player_id`
- $this->dropIndex(
- '{{%idx-inquiry-player_id}}',
- '{{%inquiry}}'
- );
-
- $this->dropTable('{{%inquiry}}');
- }
-}
diff --git a/backend/migrations/m210320_190011_version_bump_v0_16.php b/backend/migrations/m210320_190011_version_bump_v0_16.php
deleted file mode 100644
index 187875f05..000000000
--- a/backend/migrations/m210320_190011_version_bump_v0_16.php
+++ /dev/null
@@ -1,25 +0,0 @@
-db->createCommand("INSERT INTO sysconfig (id,val) values ('platform_version','v0.16') ON DUPLICATE KEY UPDATE val=values(val)")->execute();
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.15","v0.16")')], ['id' => 'frontpage_scenario']);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->db->createCommand("INSERT INTO sysconfig (id,val) values ('platform_version','v0.15') ON DUPLICATE KEY UPDATE val=values(val)")->execute();
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.16","v0.15")')], ['id' => 'frontpage_scenario']);
- }
-}
diff --git a/backend/migrations/m210324_171416_add_created_at_column_to_target_table.php b/backend/migrations/m210324_171416_add_created_at_column_to_target_table.php
deleted file mode 100644
index e74e05582..000000000
--- a/backend/migrations/m210324_171416_add_created_at_column_to_target_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%target}}', 'created_at', $this->datetime());
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%target}}', 'created_at');
- }
-}
diff --git a/backend/migrations/m210427_100015_update_repopulate_team_stream_procedure.php b/backend/migrations/m210427_100015_update_repopulate_team_stream_procedure.php
deleted file mode 100644
index 039602247..000000000
--- a/backend/migrations/m210427_100015_update_repopulate_team_stream_procedure.php
+++ /dev/null
@@ -1,38 +0,0 @@
-0 AND (SELECT val FROM sysconfig WHERE id='teams')=1 THEN
- START TRANSACTION;
- UPDATE team_score SET points=0 WHERE team_id=tid;
- DELETE FROM team_stream WHERE team_id=tid;
- INSERT INTO team_stream SELECT tid,model,model_id,points,ts FROM stream WHERE model!='user' AND player_id IN (select player_id FROM team_player WHERE team_id=tid) GROUP BY model,model_id ORDER BY id,ts;
- IF `_rollback` THEN
- ROLLBACK;
- ELSE
- COMMIT;
- END IF;
- END IF;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m210427_135745_add_weight_column_to_target_table.php b/backend/migrations/m210427_135745_add_weight_column_to_target_table.php
deleted file mode 100644
index 1bdfdfcde..000000000
--- a/backend/migrations/m210427_135745_add_weight_column_to_target_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%target}}', 'weight', $this->integer()->notNull()->defaultValue(0));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%target}}', 'weight');
- }
-}
diff --git a/backend/migrations/m210428_101835_add_healthcheck_column_to_target_table.php b/backend/migrations/m210428_101835_add_healthcheck_column_to_target_table.php
deleted file mode 100644
index af0c5f780..000000000
--- a/backend/migrations/m210428_101835_add_healthcheck_column_to_target_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%target}}', 'healthcheck', $this->boolean()->notNull()->defaultValue(1));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%target}}', 'healthcheck');
- }
-}
diff --git a/backend/migrations/m210430_154641_create_target_started_counter_function.php b/backend/migrations/m210430_154641_create_target_started_counter_function.php
deleted file mode 100644
index 2969562ae..000000000
--- a/backend/migrations/m210430_154641_create_target_started_counter_function.php
+++ /dev/null
@@ -1,28 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m210430_155141_create_target_solved_percentage_function.php b/backend/migrations/m210430_155141_create_target_solved_percentage_function.php
deleted file mode 100644
index 41f98dc7b..000000000
--- a/backend/migrations/m210430_155141_create_target_solved_percentage_function.php
+++ /dev/null
@@ -1,28 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m210430_222042_create_news_table.php b/backend/migrations/m210430_222042_create_news_table.php
deleted file mode 100644
index cb533eee2..000000000
--- a/backend/migrations/m210430_222042_create_news_table.php
+++ /dev/null
@@ -1,32 +0,0 @@
-createTable('{{%news}}', [
- 'id' => $this->primaryKey(),
- 'title' => $this->string(),
- 'body' => $this->text(),
- 'category' => $this->string(),
- 'created_at' => $this->datetime(),
- 'updated_at' => $this->datetime(),
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%news}}');
- }
-}
diff --git a/backend/migrations/m210505_001319_add_category_column_to_target_table.php b/backend/migrations/m210505_001319_add_category_column_to_target_table.php
deleted file mode 100644
index 332ba567a..000000000
--- a/backend/migrations/m210505_001319_add_category_column_to_target_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%target}}', 'category', $this->string());
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%target}}', 'category');
- }
-}
diff --git a/backend/migrations/m210505_012544_alter_category_column_on_target_table.php b/backend/migrations/m210505_012544_alter_category_column_on_target_table.php
deleted file mode 100644
index ab68912d3..000000000
--- a/backend/migrations/m210505_012544_alter_category_column_on_target_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-alterColumn('target', 'parameters', $this->text());
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->alterColumn('target', 'parameters', $this->string());
- }
-}
diff --git a/backend/migrations/m210507_234702_add_imageparams_column_on_target_table.php b/backend/migrations/m210507_234702_add_imageparams_column_on_target_table.php
deleted file mode 100644
index aefb8b024..000000000
--- a/backend/migrations/m210507_234702_add_imageparams_column_on_target_table.php
+++ /dev/null
@@ -1,27 +0,0 @@
-addColumn('target', 'imageparams', $this->text());
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('target', 'imageparams');
- }
-
-}
diff --git a/backend/migrations/m210510_085808_version_bimp_v0_17.php b/backend/migrations/m210510_085808_version_bimp_v0_17.php
deleted file mode 100644
index 626d9a1a0..000000000
--- a/backend/migrations/m210510_085808_version_bimp_v0_17.php
+++ /dev/null
@@ -1,24 +0,0 @@
-db->createCommand("INSERT INTO sysconfig (id,val) values ('platform_version','v0.17') ON DUPLICATE KEY UPDATE val=values(val)")->execute();
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.16","v0.17")')], ['id' => 'frontpage_scenario']);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->db->createCommand("INSERT INTO sysconfig (id,val) values ('platform_version','v0.16') ON DUPLICATE KEY UPDATE val=values(val)")->execute();
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.17","v0.16")')], ['id' => 'frontpage_scenario']);
- }
-}
diff --git a/backend/migrations/m210709_173314_create_target_metadata_table.php b/backend/migrations/m210709_173314_create_target_metadata_table.php
deleted file mode 100644
index b58b28d1c..000000000
--- a/backend/migrations/m210709_173314_create_target_metadata_table.php
+++ /dev/null
@@ -1,46 +0,0 @@
-createTable('{{%target_metadata}}', [
- 'target_id' => $this->primaryKey(),
- 'scenario' => $this->text(),
- 'instructions' => $this->text(),
- 'solution' => $this->text(),
- 'pre_credits' => $this->text(),
- 'post_credits' => $this->text(),
- 'pre_exploitation'=> $this->text(),
- 'post_exploitation'=> $this->text(),
- 'created_at'=> $this->datetime(),
- 'updated_at'=> $this->dateTime(),
-
- ]);
- $this->addForeignKey(
- '{{%fk-target_metadata-target_id}}',
- '{{%target_metadata}}',
- 'target_id',
- '{{%target}}',
- 'id',
- 'CASCADE'
- );
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%target_metadata}}');
- }
-}
diff --git a/backend/migrations/m210803_203701_alter_player_rank_primary_key.php b/backend/migrations/m210803_203701_alter_player_rank_primary_key.php
deleted file mode 100644
index c54a95275..000000000
--- a/backend/migrations/m210803_203701_alter_player_rank_primary_key.php
+++ /dev/null
@@ -1,28 +0,0 @@
-dropPrimaryKey('', 'player_rank', ['id']);
- $this->addPrimaryKey('', 'player_rank', ['id', 'player_id']);
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropPrimaryKey('', 'player_rank', ['id', 'player_id']);
- $this->addPrimaryKey('', 'player_rank', ['id']);
- }
-}
diff --git a/backend/migrations/m210809_110749_add_affiliation_column_to_player_table.php b/backend/migrations/m210809_110749_add_affiliation_column_to_player_table.php
deleted file mode 100644
index 347c12052..000000000
--- a/backend/migrations/m210809_110749_add_affiliation_column_to_player_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('player', 'affiliation', $this->text());
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('player', 'affiliation');
- }
-}
diff --git a/backend/migrations/m210929_194632_update_calculate_player_ranks_for_military.php b/backend/migrations/m210929_194632_update_calculate_player_ranks_for_military.php
deleted file mode 100644
index a05ce8831..000000000
--- a/backend/migrations/m210929_194632_update_calculate_player_ranks_for_military.php
+++ /dev/null
@@ -1,49 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m210929_194918_update_calculate_team_ranks_for_military.php b/backend/migrations/m210929_194918_update_calculate_team_ranks_for_military.php
deleted file mode 100644
index 5dcd23a64..000000000
--- a/backend/migrations/m210929_194918_update_calculate_team_ranks_for_military.php
+++ /dev/null
@@ -1,48 +0,0 @@
-0 AND (SELECT val FROM sysconfig WHERE id='teams')=1 THEN
- CREATE TEMPORARY TABLE `tr_ranking` (id int primary key AUTO_INCREMENT,team_id int) ENGINE=MEMORY CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- START TRANSACTION;
- insert into tr_ranking select NULL,t.team_id from team_score as t left join team as t2 on t.team_id=t2.id WHERE t2.academic=1 order by points desc,t.ts asc, t.team_id asc;
- insert into team_rank select * from tr_ranking ON DUPLICATE KEY UPDATE id=values(id);
- COMMIT;
- DROP TABLE `tr_ranking`;
-
- CREATE TEMPORARY TABLE `tr_ranking` (id int primary key AUTO_INCREMENT,team_id int) ENGINE=MEMORY CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- START TRANSACTION;
- insert into tr_ranking select NULL,t.team_id from team_score as t left join team as t2 on t.team_id=t2.id WHERE t2.academic=0 order by points desc,t.ts asc, t.team_id asc;
- insert into team_rank select * from tr_ranking ON DUPLICATE KEY UPDATE id=values(id);
- COMMIT;
- DROP TABLE `tr_ranking`;
-
- CREATE TEMPORARY TABLE `tr_ranking` (id int primary key AUTO_INCREMENT,team_id int) ENGINE=MEMORY CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- START TRANSACTION;
- insert into tr_ranking select NULL,t.team_id from team_score as t left join team as t2 on t.team_id=t2.id WHERE t2.academic=2 order by points desc,t.ts asc, t.team_id asc;
- insert into team_rank select * from tr_ranking ON DUPLICATE KEY UPDATE id=values(id);
- COMMIT;
- DROP TABLE `tr_ranking`;
-
- END IF;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m211108_105742_version_bump_v0_18.php b/backend/migrations/m211108_105742_version_bump_v0_18.php
deleted file mode 100644
index c1c9824f4..000000000
--- a/backend/migrations/m211108_105742_version_bump_v0_18.php
+++ /dev/null
@@ -1,29 +0,0 @@
-update('sysconfig', ['val'=>'v0.18'], ['id'=>'platform_version']);
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.17","v0.18")')], ['id' => 'frontpage_scenario']);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->update('sysconfig', ['val'=>'v0.17'], ['id'=>'platform_version']);
- $this->update('sysconfig', ['val'=>new Expression('REPLACE(val,"v0.18","v0.17")')], ['id' => 'frontpage_scenario']);
- }
-
-}
diff --git a/backend/migrations/m211110_093133_create_rotate_notifications_event.php b/backend/migrations/m211110_093133_create_rotate_notifications_event.php
deleted file mode 100644
index 307a07d65..000000000
--- a/backend/migrations/m211110_093133_create_rotate_notifications_event.php
+++ /dev/null
@@ -1,32 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m211129_224218_update_init_mysql_procedure_set_timezone.php b/backend/migrations/m211129_224218_update_init_mysql_procedure_set_timezone.php
deleted file mode 100644
index 085a64634..000000000
--- a/backend/migrations/m211129_224218_update_init_mysql_procedure_set_timezone.php
+++ /dev/null
@@ -1,32 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m211201_094407_add_signup_ip_signin_ip_to_player_last_table.php b/backend/migrations/m211201_094407_add_signup_ip_signin_ip_to_player_last_table.php
deleted file mode 100644
index c128cd141..000000000
--- a/backend/migrations/m211201_094407_add_signup_ip_signin_ip_to_player_last_table.php
+++ /dev/null
@@ -1,47 +0,0 @@
-addColumn('player_last', 'signup_ip', 'INT UNSIGNED AFTER vpn_local_address');
- $this->addColumn('player_last', 'signin_ip', 'INT UNSIGNED AFTER signup_ip');
- $this->createIndex(
- 'idx-player_last-signup_ip',
- 'player_last',
- 'signup_ip'
- );
- $this->createIndex(
- 'idx-player_last-signin_ip',
- 'player_last',
- 'signin_ip'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropIndex(
- 'idx-player_last-signup_ip',
- 'player_last'
- );
- $this->dropIndex(
- 'idx-player_last-signin_ip',
- 'player_last'
- );
- $this->dropColumn('player_last', 'signup_ip');
- $this->dropColumn('player_last', 'signin_ip');
- }
-
-}
diff --git a/backend/migrations/m211203_230639_create_email_template_table.php b/backend/migrations/m211203_230639_create_email_template_table.php
deleted file mode 100644
index 8d90cbeb8..000000000
--- a/backend/migrations/m211203_230639_create_email_template_table.php
+++ /dev/null
@@ -1,33 +0,0 @@
-createTable('{{%email_template}}', [
- 'id' => $this->primaryKey(),
- 'name' => $this->string(32),
- 'title' => $this->string(),
- 'html' => $this->text(),
- 'txt' => $this->text(),
- 'created_at'=>$this->datetime(),
- 'updated_at'=>$this->datetime(),
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%email_template}}');
- }
-}
diff --git a/backend/migrations/m211206_200949_add_writeup_allowed_column_to_target_table.php b/backend/migrations/m211206_200949_add_writeup_allowed_column_to_target_table.php
deleted file mode 100644
index 5d68444bf..000000000
--- a/backend/migrations/m211206_200949_add_writeup_allowed_column_to_target_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%target}}', 'writeup_allowed', $this->integer()->defaultValue(1));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%target}}', 'writeup_allowed');
- }
-}
diff --git a/backend/migrations/m211206_215320_create_player_disabledroute_table.php b/backend/migrations/m211206_215320_create_player_disabledroute_table.php
deleted file mode 100644
index 300b52f8e..000000000
--- a/backend/migrations/m211206_215320_create_player_disabledroute_table.php
+++ /dev/null
@@ -1,66 +0,0 @@
-createTable('{{%player_disabledroute}}', [
- 'id' => $this->primaryKey(),
- 'player_id' => $this->integer()->unsigned(),
- 'route' => $this->string(),
- ]);
-
- // creates index for column `player_id`
- $this->createIndex(
- '{{%idx-player_disabledroute-player_id}}',
- '{{%player_disabledroute}}',
- 'player_id'
- );
- $this->createIndex(
- '{{%idx-player_disabledroute-route}}',
- '{{%player_disabledroute}}',
- 'route'
- );
-
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-player_disabledroute-player_id}}',
- '{{%player_disabledroute}}',
- 'player_id',
- '{{%player}}',
- 'id',
- 'CASCADE'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- // drops foreign key for table `{{%player}}`
- $this->dropForeignKey(
- '{{%fk-player_disabledroute-player_id}}',
- '{{%player_disabledroute}}'
- );
-
- // drops index for column `player_id`
- $this->dropIndex(
- '{{%idx-player_disabledroute-player_id}}',
- '{{%player_disabledroute}}'
- );
-
- $this->dropTable('{{%player_disabledroute}}');
- }
-}
diff --git a/backend/migrations/m211207_164930_create_player_relation_table.php b/backend/migrations/m211207_164930_create_player_relation_table.php
deleted file mode 100644
index eed877b7c..000000000
--- a/backend/migrations/m211207_164930_create_player_relation_table.php
+++ /dev/null
@@ -1,67 +0,0 @@
-createTable('{{%player_relation}}', [
- 'player_id' => $this->integer()->unsigned(),
- 'referred_id' => $this->integer()->unsigned(),
- 'PRIMARY KEY (player_id)',
- ]);
-
- // creates index for column `player_id`
- $this->createIndex(
- '{{%idx-player_relation-player_id}}',
- '{{%player_relation}}',
- 'player_id'
- );
- // creates index for column `player_id`
- $this->createIndex(
- '{{%idx-player_relation-referred_id}}',
- '{{%player_relation}}',
- 'referred_id'
- );
-
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-player_relation-player_id}}',
- '{{%player_relation}}',
- 'player_id',
- '{{%player}}',
- 'id',
- 'CASCADE'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- // drops foreign key for table `{{%player}}`
- $this->dropForeignKey(
- '{{%fk-player_relation-player_id}}',
- '{{%player_relation}}'
- );
-
- // drops index for column `player_id`
- $this->dropIndex(
- '{{%idx-player_relation-player_id}}',
- '{{%player_relation}}'
- );
-
- $this->dropTable('{{%player_relation}}');
- }
-}
diff --git a/backend/migrations/m211212_093135_create_banned_mx_server_table.php b/backend/migrations/m211212_093135_create_banned_mx_server_table.php
deleted file mode 100644
index 69e8262d8..000000000
--- a/backend/migrations/m211212_093135_create_banned_mx_server_table.php
+++ /dev/null
@@ -1,31 +0,0 @@
-createTable('{{%banned_mx_server}}', [
- 'id' => $this->primaryKey(),
- 'name' => $this->string()->unique(),
- 'notes' => $this->text(),
- 'created_at' => $this->dateTime(),
- 'updated_at'=>$this->dateTime(),
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%banned_mx_server}}');
- }
-}
diff --git a/backend/migrations/m211214_203948_add_player_spin_and_headshot_spin_columns_to_target_table.php b/backend/migrations/m211214_203948_add_player_spin_and_headshot_spin_columns_to_target_table.php
deleted file mode 100644
index ff3482e6b..000000000
--- a/backend/migrations/m211214_203948_add_player_spin_and_headshot_spin_columns_to_target_table.php
+++ /dev/null
@@ -1,27 +0,0 @@
-addColumn('{{%target}}', 'player_spin', $this->boolean()->defaultValue(1));
- $this->addColumn('{{%target}}', 'headshot_spin', $this->boolean()->defaultValue(1));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%target}}', 'player_spin');
- $this->dropColumn('{{%target}}', 'headshot_spin');
- }
-}
diff --git a/backend/migrations/m211214_210103_update_tai_headshot_trigger.php b/backend/migrations/m211214_210103_update_tai_headshot_trigger.php
deleted file mode 100644
index 85191027d..000000000
--- a/backend/migrations/m211214_210103_update_tai_headshot_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-0 THEN
- INSERT IGNORE INTO spin_queue (target_id, player_id,created_at) VALUES (NEW.target_id,NEW.player_id,NOW());
- END IF;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m211215_105831_create_url_route_table.php b/backend/migrations/m211215_105831_create_url_route_table.php
deleted file mode 100644
index 4b2716db1..000000000
--- a/backend/migrations/m211215_105831_create_url_route_table.php
+++ /dev/null
@@ -1,30 +0,0 @@
-createTable('{{%url_route}}', [
- 'id' => $this->primaryKey(),
- 'source' => $this->string()->unique()->notNull(),
- 'destination' => $this->string()->notNull(),
- 'weight'=>$this->integer()->notNull()->defaultValue(0),
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%url_route}}');
- }
-}
diff --git a/backend/migrations/m211215_110521_create_tai_url_route_trigger.php b/backend/migrations/m211215_110521_create_tai_url_route_trigger.php
deleted file mode 100644
index 47cabdb9a..000000000
--- a/backend/migrations/m211215_110521_create_tai_url_route_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m211215_110529_create_tau_url_route_trigger.php b/backend/migrations/m211215_110529_create_tau_url_route_trigger.php
deleted file mode 100644
index d65a4e7ab..000000000
--- a/backend/migrations/m211215_110529_create_tau_url_route_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m211215_110533_create_tad_url_route_trigger.php b/backend/migrations/m211215_110533_create_tad_url_route_trigger.php
deleted file mode 100644
index 9c653e4ea..000000000
--- a/backend/migrations/m211215_110533_create_tad_url_route_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m211218_221244_create_player_counter_nf_table.php b/backend/migrations/m211218_221244_create_player_counter_nf_table.php
deleted file mode 100644
index cfc6cc67e..000000000
--- a/backend/migrations/m211218_221244_create_player_counter_nf_table.php
+++ /dev/null
@@ -1,30 +0,0 @@
-createTable('{{%player_counter_nf}}', [
- 'player_id' => $this->primaryKey(),
- 'metric' => $this->string()->notNull(),
- 'counter' => $this->bigInteger()->notNull()->defaultValue(0),
- 'UNIQUE KEY (player_id,metric)'
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%player_counter_nf}}');
- }
-}
diff --git a/backend/migrations/m211221_132922_version_bump_v0_19_0.php b/backend/migrations/m211221_132922_version_bump_v0_19_0.php
deleted file mode 100644
index 854ca7f46..000000000
--- a/backend/migrations/m211221_132922_version_bump_v0_19_0.php
+++ /dev/null
@@ -1,26 +0,0 @@
-update('sysconfig', ['val'=>'v0.19.0'], ['id'=>'platform_version']);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->update('sysconfig', ['val'=>'v0.18'], ['id'=>'platform_version']);
- }
-
-}
diff --git a/backend/migrations/m211228_092925_add_pending_progress_column_to_profile_table.php b/backend/migrations/m211228_092925_add_pending_progress_column_to_profile_table.php
deleted file mode 100644
index 45d71496f..000000000
--- a/backend/migrations/m211228_092925_add_pending_progress_column_to_profile_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%profile}}', 'pending_progress', $this->boolean()->notNull()->defaultValue(1));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%profile}}', 'pending_progress');
- }
-}
diff --git a/backend/migrations/m211230_134128_update_tai_url_route_trigger.php b/backend/migrations/m211230_134128_update_tai_url_route_trigger.php
deleted file mode 100644
index 6c3a7575b..000000000
--- a/backend/migrations/m211230_134128_update_tai_url_route_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m211230_134133_update_tau_url_route_trigger.php b/backend/migrations/m211230_134133_update_tau_url_route_trigger.php
deleted file mode 100644
index b6993b964..000000000
--- a/backend/migrations/m211230_134133_update_tau_url_route_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m211230_134134_update_tad_url_route_trigger.php b/backend/migrations/m211230_134134_update_tad_url_route_trigger.php
deleted file mode 100644
index d4c9ddada..000000000
--- a/backend/migrations/m211230_134134_update_tad_url_route_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220104_233602_add_inviteonly_column_recruitment_column_to_team_table.php b/backend/migrations/m220104_233602_add_inviteonly_column_recruitment_column_to_team_table.php
deleted file mode 100644
index fe0968356..000000000
--- a/backend/migrations/m220104_233602_add_inviteonly_column_recruitment_column_to_team_table.php
+++ /dev/null
@@ -1,27 +0,0 @@
-addColumn('{{%team}}', 'inviteonly', $this->boolean()->notNull()->defaultValue(true));
- $this->addColumn('{{%team}}', 'recruitment', $this->string());
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%team}}', 'inviteonly');
- $this->dropColumn('{{%team}}', 'recruitment');
- }
-}
diff --git a/backend/migrations/m220109_113851_create_vpn_template_table.php b/backend/migrations/m220109_113851_create_vpn_template_table.php
deleted file mode 100644
index 93afd125c..000000000
--- a/backend/migrations/m220109_113851_create_vpn_template_table.php
+++ /dev/null
@@ -1,37 +0,0 @@
-createTable('{{%vpn_template}}', [
- 'id' => $this->primaryKey(),
- 'name' => $this->string()->notNull()->unique(),
- 'client' => $this->boolean()->notNull()->defaultValue(1),
- 'server' => $this->boolean()->notNull()->defaultValue(0),
- 'active' => $this->boolean()->notNull()->defaultValue(1),
- 'visible' => $this->boolean()->notNull()->defaultValue(1),
- 'filename' => $this->string()->notNull()->defaultValue('echoCTF.ovpn'),
- 'description' => $this->text(),
- 'content' => $this->text(),
- 'created_at' => $this->datetime(),
- 'updated_at' => $this->dateTime(),
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function down()
- {
- $this->dropTable('{{%vpn_template}}');
- }
-}
diff --git a/backend/migrations/m220110_115351_add_id_column_to_writeup_table.php b/backend/migrations/m220110_115351_add_id_column_to_writeup_table.php
deleted file mode 100644
index 8762ef0c4..000000000
--- a/backend/migrations/m220110_115351_add_id_column_to_writeup_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%writeup}}', 'id', 'INTEGER NOT NULL UNIQUE AUTO_INCREMENT');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%writeup}}', 'id');
- }
-}
diff --git a/backend/migrations/m220110_220014_create_writeup_rating_table.php b/backend/migrations/m220110_220014_create_writeup_rating_table.php
deleted file mode 100644
index 43d814458..000000000
--- a/backend/migrations/m220110_220014_create_writeup_rating_table.php
+++ /dev/null
@@ -1,95 +0,0 @@
-createTable('{{%writeup_rating}}', [
- 'id' => $this->primaryKey(),
- 'writeup_id' => $this->integer()->notNull(),
- 'player_id' => $this->integer(10)->unsigned()->notNull(),
- 'rating' => $this->integer()->unsigned()->notNull()->defaultValue(0),
- 'created_at' => $this->dateTime(),
- 'updated_at' => $this->dateTime(),
- 'unique key (writeup_id,player_id)'
- ]);
-
- // creates index for column `id`
- $this->createIndex(
- '{{%idx-writeup_rating-writeup_id}}',
- '{{%writeup_rating}}',
- 'writeup_id'
- );
-
- // add foreign key for table `{{%writeup}}`
- $this->addForeignKey(
- '{{%fk-writeup_rating-writeup_id}}',
- '{{%writeup_rating}}',
- 'writeup_id',
- '{{%writeup}}',
- 'id',
- 'CASCADE'
- );
-
- // creates index for column `player_id`
- $this->createIndex(
- '{{%idx-writeup_rating-player_id}}',
- '{{%writeup_rating}}',
- 'player_id'
- );
-
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-writeup_rating-player_id}}',
- '{{%writeup_rating}}',
- 'player_id',
- '{{%player}}',
- 'id',
- 'CASCADE'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function down()
- {
- // drops foreign key for table `{{%writeup}}`
- $this->dropForeignKey(
- '{{%fk-writeup_rating-writeup_id}}',
- '{{%writeup_rating}}'
- );
-
- // drops index for column `id`
- $this->dropIndex(
- '{{%idx-writeup_rating-writeup_id}}',
- '{{%writeup_rating}}'
- );
-
- // drops foreign key for table `{{%player}}`
- $this->dropForeignKey(
- '{{%fk-writeup_rating-player_id}}',
- '{{%writeup_rating}}'
- );
-
- // drops index for column `player_id`
- $this->dropIndex(
- '{{%idx-writeup_rating-player_id}}',
- '{{%writeup_rating}}'
- );
-
- $this->dropTable('{{%writeup_rating}}');
- }
-}
diff --git a/backend/migrations/m220118_091135_add_serial_column_to_player_ssl_table.php b/backend/migrations/m220118_091135_add_serial_column_to_player_ssl_table.php
deleted file mode 100644
index 456d0ddd9..000000000
--- a/backend/migrations/m220118_091135_add_serial_column_to_player_ssl_table.php
+++ /dev/null
@@ -1,27 +0,0 @@
-addColumn('{{%player_ssl}}', 'serial', 'BIGINT UNSIGNED NOT NULL UNIQUE AUTO_INCREMENT AFTER player_id');
- $this->db->createCommand("ALTER TABLE {{%player_ssl}} AUTO_INCREMENT=1600000000")->execute();
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%player_ssl}}', 'serial');
- }
-}
diff --git a/backend/migrations/m220120_225403_switch_database_and_table_encodings.php b/backend/migrations/m220120_225403_switch_database_and_table_encodings.php
deleted file mode 100644
index f754b158a..000000000
--- a/backend/migrations/m220120_225403_switch_database_and_table_encodings.php
+++ /dev/null
@@ -1,115 +0,0 @@
-execute("SET foreign_key_checks = 0");
- foreach($this->tables as $table)
- $this->execute("ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci");
- $this->execute("SET foreign_key_checks = 1");
- $db=$this->db->createCommand("SELECT DATABASE() FROM DUAL")->queryScalar();
- $this->execute("alter database $db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;");
- }
-
- public function down()
- {
- echo "m220120_225403_switch_encoding cannot be reverted.\n";
-
- }
-}
diff --git a/backend/migrations/m220330_201728_create_server_table.php b/backend/migrations/m220330_201728_create_server_table.php
deleted file mode 100644
index 68d6fa577..000000000
--- a/backend/migrations/m220330_201728_create_server_table.php
+++ /dev/null
@@ -1,34 +0,0 @@
-createTable('{{%server}}', [
- 'id' => $this->primaryKey(),
- 'name' => $this->string(32)->unique()->notNull(),
- 'network' => $this->string(32)->notNull(),
- 'ip' => $this->integer()->unsigned()->notNull(),
- 'description' => $this->text(),
- 'service' => 'ENUM("docker") NOT NULL DEFAULT "docker"',
- 'connstr' => $this->string()->notNull(),
- 'provider_id' => $this->string(),
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%server}}');
- }
-}
diff --git a/backend/migrations/m220330_215100_create_target_instance_table.php b/backend/migrations/m220330_215100_create_target_instance_table.php
deleted file mode 100644
index b4265e0a6..000000000
--- a/backend/migrations/m220330_215100_create_target_instance_table.php
+++ /dev/null
@@ -1,65 +0,0 @@
-createTable('{{%target_instance}}', [
- 'player_id' => $this->integer()->unsigned()->notNull(),
- 'target_id' => $this->integer()->notNull(),
- 'server_id' => $this->integer()->defaultValue(NULL),
- 'ip' => $this->integer()->unsigned()->defaultValue(0),
- 'reboot' => 'tinyint unsigned not null default 0',
- 'created_at' => 'DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP',
- 'updated_at' => 'DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP',
- 'PRIMARY KEY (player_id)',
- ]);
-
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-target_instance-player_id}}',
- '{{%target_instance}}',
- 'player_id',
- '{{%player}}',
- 'id',
- 'CASCADE'
- );
-
- // creates index for column `target_id`
- $this->createIndex(
- '{{%idx-target_instance-target_id}}',
- '{{%target_instance}}',
- 'target_id'
- );
-
- // add foreign key for table `{{%target}}`
- $this->addForeignKey(
- '{{%fk-target_instance-target_id}}',
- '{{%target_instance}}',
- 'target_id',
- '{{%target}}',
- 'id',
- 'CASCADE'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function down()
- {
- $this->dropTable('{{%target_instance}}');
- }
-}
diff --git a/backend/migrations/m220330_215101_create_target_instance_audit_table.php b/backend/migrations/m220330_215101_create_target_instance_audit_table.php
deleted file mode 100644
index 89fe2ac2f..000000000
--- a/backend/migrations/m220330_215101_create_target_instance_audit_table.php
+++ /dev/null
@@ -1,85 +0,0 @@
-createTable('{{%target_instance_audit}}', [
- 'id' => $this->primaryKey(),
- 'op'=>'CHAR(1) NOT NULL DEFAULT "i"',
- 'player_id' => $this->integer()->unsigned()->notNull(),
- 'target_id' => $this->integer()->notNull(),
- 'server_id' => $this->integer()->defaultValue(NULL),
- 'ip' => $this->integer()->unsigned()->defaultValue(0),
- 'reboot' => 'tinyint unsigned not null default 0',
- 'ts' => 'TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP',
- ]/* Disable this since its only available on 10.2.5,'ENGINE=RocksDB'*/);
- //
- // creates index for column `player_id`
- $this->createIndex(
- '{{%idx-target_instance_audit-player_id}}',
- '{{%target_instance_audit}}',
- 'player_id'
- );
-
- // add foreign key for table `{{%player}}`
-// $this->addForeignKey(
-// '{{%fk-target_instance_audit-player_id}}',
-// '{{%target_instance_audit}}',
-// 'player_id',
-// '{{%player}}',
-// 'id',
-// 'CASCADE'
-// );
-//
- // creates index for column `target_id`
- $this->createIndex(
- '{{%idx-target_instance_audit-target_id}}',
- '{{%target_instance_audit}}',
- 'target_id'
- );
-
- // add foreign key for table `{{%target}}`
-// $this->addForeignKey(
-// '{{%fk-target_instance_audit-target_id}}',
-// '{{%target_instance_audit}}',
-// 'target_id',
-// '{{%target}}',
-// 'id',
-// 'CASCADE'
-// );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
-
- // drops index for column `player_id`
- $this->dropIndex(
- '{{%idx-target_instance_audit-player_id}}',
- '{{%target_instance_audit}}'
- );
-
- // drops index for column `target_id`
- $this->dropIndex(
- '{{%idx-target_instance_audit-target_id}}',
- '{{%target_instance_audit}}'
- );
-
- $this->dropTable('{{%target_instance_audit}}');
- }
-}
diff --git a/backend/migrations/m220403_223247_create_tad_target_instance_trigger.php b/backend/migrations/m220403_223247_create_tad_target_instance_trigger.php
deleted file mode 100644
index e36e93b7b..000000000
--- a/backend/migrations/m220403_223247_create_tad_target_instance_trigger.php
+++ /dev/null
@@ -1,32 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220403_223259_create_tau_target_instance_trigger.php b/backend/migrations/m220403_223259_create_tau_target_instance_trigger.php
deleted file mode 100644
index 3241572bd..000000000
--- a/backend/migrations/m220403_223259_create_tau_target_instance_trigger.php
+++ /dev/null
@@ -1,37 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220403_223341_create_tai_target_instance_trigger.php b/backend/migrations/m220403_223341_create_tai_target_instance_trigger.php
deleted file mode 100644
index b26750ab8..000000000
--- a/backend/migrations/m220403_223341_create_tai_target_instance_trigger.php
+++ /dev/null
@@ -1,32 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220424_230347_create_tai_disabled_route_trigger.php b/backend/migrations/m220424_230347_create_tai_disabled_route_trigger.php
deleted file mode 100644
index 4b283fa1f..000000000
--- a/backend/migrations/m220424_230347_create_tai_disabled_route_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220424_230356_create_tau_disabled_route_trigger.php b/backend/migrations/m220424_230356_create_tau_disabled_route_trigger.php
deleted file mode 100644
index b3e75950b..000000000
--- a/backend/migrations/m220424_230356_create_tau_disabled_route_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220424_230404_create_tad_disabled_route_trigger.php b/backend/migrations/m220424_230404_create_tad_disabled_route_trigger.php
deleted file mode 100644
index 4d72eb20b..000000000
--- a/backend/migrations/m220424_230404_create_tad_disabled_route_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220425_123353_create_tai_player_disabledroute_trigger.php b/backend/migrations/m220425_123353_create_tai_player_disabledroute_trigger.php
deleted file mode 100644
index 478a725f0..000000000
--- a/backend/migrations/m220425_123353_create_tai_player_disabledroute_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220425_123404_create_tau_player_disabledroute_trigger.php b/backend/migrations/m220425_123404_create_tau_player_disabledroute_trigger.php
deleted file mode 100644
index 0509cf065..000000000
--- a/backend/migrations/m220425_123404_create_tau_player_disabledroute_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220425_123411_create_tad_player_disabledroute_trigger.php b/backend/migrations/m220425_123411_create_tad_player_disabledroute_trigger.php
deleted file mode 100644
index 9bff1f9cb..000000000
--- a/backend/migrations/m220425_123411_create_tad_player_disabledroute_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220425_165747_alter_table_stream_modify_column_ts_precision.php b/backend/migrations/m220425_165747_alter_table_stream_modify_column_ts_precision.php
deleted file mode 100644
index 422d13bdb..000000000
--- a/backend/migrations/m220425_165747_alter_table_stream_modify_column_ts_precision.php
+++ /dev/null
@@ -1,21 +0,0 @@
-alterColumn('stream', 'ts', 'timestamp(4) not null default current_timestamp');
- }
-
- public function down()
- {
- $this->alterColumn('stream', 'ts', 'timestamp() not null default current_timestamp');
- }
-}
diff --git a/backend/migrations/m220425_221753_alter_table_player_counter_nf_primary_key.php b/backend/migrations/m220425_221753_alter_table_player_counter_nf_primary_key.php
deleted file mode 100644
index df02a6625..000000000
--- a/backend/migrations/m220425_221753_alter_table_player_counter_nf_primary_key.php
+++ /dev/null
@@ -1,32 +0,0 @@
-dropPrimaryKey('PRIMARY','player_counter_nf');
- $this->alterColumn('player_counter_nf', 'player_id', 'INT NOT NULL');
- $this->dropIndex('player_id','player_counter_nf');
- $this->addPrimaryKey('player_counter_nf-player_id-metric', 'player_counter_nf', ['player_id', 'metric']);
- $this->update('player_counter_nf',['counter'=>0]);
- }
-
- public function down()
- {
- $this->dropPrimaryKey('PRIMARY','player_counter_nf');
- $this->alterColumn('player_counter_nf', 'player_id', 'INT NOT NULL AUTO_INCREMENT PRIMARY KEY');
- $this->createIndex(
- '{{player_id}}',
- '{{%player_counter_nf}}',
- ['player_id', 'metric'],
- true
- );
- }
-}
diff --git a/backend/migrations/m220425_221754_version_bump_v0_20_0.php b/backend/migrations/m220425_221754_version_bump_v0_20_0.php
deleted file mode 100644
index 7610b9d57..000000000
--- a/backend/migrations/m220425_221754_version_bump_v0_20_0.php
+++ /dev/null
@@ -1,26 +0,0 @@
-update('sysconfig', ['val'=>'v0.20.0'], ['id'=>'platform_version']);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->update('sysconfig', ['val'=>'v0.19.0'], ['id'=>'platform_version']);
- }
-
-}
diff --git a/backend/migrations/m220506_092818_create_player_score_monthly_table.php b/backend/migrations/m220506_092818_create_player_score_monthly_table.php
deleted file mode 100644
index 75ebdf861..000000000
--- a/backend/migrations/m220506_092818_create_player_score_monthly_table.php
+++ /dev/null
@@ -1,32 +0,0 @@
-createTable('{{%player_score_monthly}}', [
- 'player_id' => $this->integer()->notNull(),
- 'points' => $this->bigInteger()->notNull()->defaultValue(0),
- 'dated_at' => $this->integer()->notNull(),
- 'ts' => $this->timestamp(),
- 'PRIMARY KEY (player_id,dated_at)'
- ]);
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%player_score_monthly}}');
- }
-}
diff --git a/backend/migrations/m220506_104907_update_tai_stream_trigger_player_score_on_points.php b/backend/migrations/m220506_104907_update_tai_stream_trigger_player_score_on_points.php
deleted file mode 100644
index c28f0f9eb..000000000
--- a/backend/migrations/m220506_104907_update_tai_stream_trigger_player_score_on_points.php
+++ /dev/null
@@ -1,36 +0,0 @@
-0 THEN
- INSERT INTO player_score (player_id,points) VALUES (NEW.player_id,NEW.points) ON DUPLICATE KEY UPDATE points=points+values(points);
- END IF;
- SELECT team_id INTO lteam_id FROM team_player WHERE player_id=NEW.player_id AND approved=1;
- IF lteam_id IS NOT NULL THEN
- INSERT IGNORE INTO team_stream (team_id,model,model_id,points,ts) VALUES (lteam_id,NEW.model,NEW.model_id,NEW.points,NEW.ts);
- END IF;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220506_105423_update_tau_player_score_trigger.php b/backend/migrations/m220506_105423_update_tau_player_score_trigger.php
deleted file mode 100644
index e6fa03776..000000000
--- a/backend/migrations/m220506_105423_update_tau_player_score_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220511_213708_update_tau_player_last_trigger_with_memcache.php b/backend/migrations/m220511_213708_update_tau_player_last_trigger_with_memcache.php
deleted file mode 100644
index bfc957709..000000000
--- a/backend/migrations/m220511_213708_update_tau_player_last_trigger_with_memcache.php
+++ /dev/null
@@ -1,42 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220513_002645_create_openvpn_table.php b/backend/migrations/m220513_002645_create_openvpn_table.php
deleted file mode 100644
index 193ea2c99..000000000
--- a/backend/migrations/m220513_002645_create_openvpn_table.php
+++ /dev/null
@@ -1,38 +0,0 @@
-createTable('{{%openvpn}}', [
- 'id' => $this->primaryKey(),
- 'provider_id'=>$this->string(), // eg vultr-instance-id to determine the server that will use this
- 'name' => $this->string()->unique(), // openvpn_tun0
- 'net' => $this->integer()->unsigned()->unique(), // 10.10.0.0
- 'mask' => $this->integer()->unsigned(), // 255.255.0.0
- 'management_ip' => $this->integer()->unsigned(), // 127.0.0.1
- 'management_port' => $this->smallInteger()->unsigned(), // 11195
- 'management_passwd' => $this->string(), // mypass
- 'status_log'=>$this->string(), // eg /var/log/openvpn-status.log
- 'conf' => $this->text(),
- 'updated_at' => $this->timestamp(),
- 'created_at' => $this->timestamp(),
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%openvpn}}');
- }
-}
diff --git a/backend/migrations/m220514_211321_create_target_state_table.php b/backend/migrations/m220514_211321_create_target_state_table.php
deleted file mode 100644
index b27e6a47f..000000000
--- a/backend/migrations/m220514_211321_create_target_state_table.php
+++ /dev/null
@@ -1,76 +0,0 @@
-createTable('{{%target_state}}', [
- 'id' => $this->integer()->notNull(),
- 'total_headshots'=>$this->integer()->unsigned()->notNull()->defaultValue(0),
- 'total_findings'=>$this->integer()->unsigned()->notNull()->defaultValue(0),
- 'total_treasures'=>$this->integer()->unsigned()->notNull()->defaultValue(0),
- 'player_rating'=>$this->integer()->notNull()->defaultValue(-1),
- 'timer_avg'=>$this->integer()->unsigned()->notNull()->defaultValue(0),
- 'total_writeups'=>$this->integer()->unsigned()->notNull()->defaultValue(0),
- 'approved_writeups'=>$this->integer()->unsigned()->notNull()->defaultValue(0),
- 'finding_points'=>$this->integer()->unsigned()->notNull()->defaultValue(0),
- 'treasure_points'=>$this->integer()->unsigned()->notNull()->defaultValue(0),
- 'total_points'=>$this->integer()->unsigned()->notNull()->defaultValue(0),
- 'on_network'=>$this->smallInteger()->unsigned()->notNull()->defaultValue(0),
- 'on_ondemand'=>$this->smallInteger()->unsigned()->notNull()->defaultValue(0),
- 'ondemand_state'=>$this->smallInteger()->notNull()->defaultValue(-1),
- 'PRIMARY KEY (id)',
- ]);
-
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-target_states-id}}',
- '{{%target_state}}',
- 'id',
- '{{%target}}',
- 'id',
- 'CASCADE'
- );
- $this->createIndex(
- 'idx-target_state-total_headshots',
- 'target_state',
- 'total_headshots'
- );
- $this->createIndex(
- 'idx-target_state-total_findings',
- 'target_state',
- 'total_findings'
- );
- $this->createIndex(
- 'idx-target_state-total_treasures',
- 'target_state',
- 'total_treasures'
- );
- $this->createIndex(
- 'idx-target_state-player_rating',
- 'target_state',
- 'player_rating'
- );
- $this->createIndex(
- 'idx-target_state-timer_avg',
- 'target_state',
- 'timer_avg'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%target_state}}');
- }
-}
diff --git a/backend/migrations/m220514_214530_populate_target_state_with_data.php b/backend/migrations/m220514_214530_populate_target_state_with_data.php
deleted file mode 100644
index ec2f0f635..000000000
--- a/backend/migrations/m220514_214530_populate_target_state_with_data.php
+++ /dev/null
@@ -1,59 +0,0 @@
-db->createCommand("INSERT IGNORE INTO target_state (id,total_treasures,total_findings,player_rating,total_headshots,total_writeups,approved_writeups) SELECT t.id, count(distinct treasure.id) as total_treasures, count(distinct finding.id) as total_findings, round(avg(CASE WHEN headshot.rating > -1 THEN headshot.rating END)) as player_rating,count(distinct headshot.player_id) as total_headshots, count(distinct writeup.id) as total_writeups,count(distinct (case when writeup.approved=1 then writeup.id end)) AS approved_writeups FROM target t LEFT JOIN treasure ON treasure.target_id=t.id LEFT JOIN finding ON finding.target_id=t.id LEFT JOIN headshot ON headshot.target_id=t.id LEFT JOIN writeup ON writeup.target_id=t.id GROUP BY t.id")->execute();
- // set average timer
- $this->db->createCommand("INSERT INTO target_state (id,timer_avg) SELECT target_id,AVG(timer) FROM headshot GROUP BY target_id ON DUPLICATE KEY UPDATE timer_avg=values(timer_avg)")->execute();
- // set treasure points
- $this->db->createCommand("INSERT INTO target_state (id,treasure_points) SELECT target_id,sum(points) FROM treasure GROUP BY target_id ON DUPLICATE KEY UPDATE treasure_points=values(treasure_points)")->execute();
- // set finding points
- $this->db->createCommand("INSERT INTO target_state (id,finding_points) SELECT target_id,sum(points) FROM finding GROUP BY target_id ON DUPLICATE KEY UPDATE finding_points=values(finding_points)")->execute();
-
- // set the ondemand target status
- $this->db->createCommand("INSERT INTO target_state (id, on_ondemand,ondemand_state) SELECT target_id,1,{{%state}} FROM target_ondemand ON DUPLICATE KEY UPDATE on_ondemand=values(on_ondemand),ondemand_state=values(ondemand_state)")->execute();
-
- // Set the on_network flags
- $this->db->createCommand("INSERT INTO target_state (id, on_network) SELECT DISTINCT target_id,1 FROM network_target ON DUPLICATE KEY UPDATE on_network=values(on_network)")->execute();
-
- // Set the total_points for records
- $this->db->createCommand("UPDATE target_state SET total_points=finding_points+treasure_points")->execute();
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "m220514_214530_populate_target_state_with_data cannot be reverted.\n";
-
- }
-
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
-
- }
-
- public function down()
- {
- echo "m220514_214530_populate_target_state_with_data cannot be reverted.\n";
-
- return false;
- }
- */
-}
diff --git a/backend/migrations/m220514_224351_create_tai_treasure_trigger.php b/backend/migrations/m220514_224351_create_tai_treasure_trigger.php
deleted file mode 100644
index c99cd222c..000000000
--- a/backend/migrations/m220514_224351_create_tai_treasure_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220514_224355_create_tad_treasure_trigger.php b/backend/migrations/m220514_224355_create_tad_treasure_trigger.php
deleted file mode 100644
index 29efed017..000000000
--- a/backend/migrations/m220514_224355_create_tad_treasure_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220514_225608_update_tai_finding_trigger_add_target_state.php b/backend/migrations/m220514_225608_update_tai_finding_trigger_add_target_state.php
deleted file mode 100644
index 2d9c24e05..000000000
--- a/backend/migrations/m220514_225608_update_tai_finding_trigger_add_target_state.php
+++ /dev/null
@@ -1,33 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220514_225643_update_tad_finding_trigger_add_target_state.php b/backend/migrations/m220514_225643_update_tad_finding_trigger_add_target_state.php
deleted file mode 100644
index 4a96341e7..000000000
--- a/backend/migrations/m220514_225643_update_tad_finding_trigger_add_target_state.php
+++ /dev/null
@@ -1,34 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220514_230150_update_tai_headshot_trigger_add_target_state.php b/backend/migrations/m220514_230150_update_tai_headshot_trigger_add_target_state.php
deleted file mode 100644
index 942b8b315..000000000
--- a/backend/migrations/m220514_230150_update_tai_headshot_trigger_add_target_state.php
+++ /dev/null
@@ -1,32 +0,0 @@
-0 THEN
- INSERT IGNORE INTO spin_queue (target_id, player_id,created_at) VALUES (NEW.target_id,NEW.player_id,NOW());
- END IF;
- UPDATE target_state SET total_headshots=total_headshots+1,timer_avg=(SELECT round(avg(timer)) FROM headshot WHERE target_id=NEW.target_id) WHERE id=NEW.target_id;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220514_230211_update_tad_headshot_trigger_add_target_state.php b/backend/migrations/m220514_230211_update_tad_headshot_trigger_add_target_state.php
deleted file mode 100644
index 62d4671d3..000000000
--- a/backend/migrations/m220514_230211_update_tad_headshot_trigger_add_target_state.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220515_001506_create_tai_writeup_trigger.php b/backend/migrations/m220515_001506_create_tai_writeup_trigger.php
deleted file mode 100644
index 7c7edc4de..000000000
--- a/backend/migrations/m220515_001506_create_tai_writeup_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220515_003413_create_tau_writeup_trigger.php b/backend/migrations/m220515_003413_create_tau_writeup_trigger.php
deleted file mode 100644
index 1ba142ba3..000000000
--- a/backend/migrations/m220515_003413_create_tau_writeup_trigger.php
+++ /dev/null
@@ -1,35 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220515_003818_create_tad_writeup_trigger.php b/backend/migrations/m220515_003818_create_tad_writeup_trigger.php
deleted file mode 100644
index dd815edb3..000000000
--- a/backend/migrations/m220515_003818_create_tad_writeup_trigger.php
+++ /dev/null
@@ -1,35 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220515_004033_create_tau_headshot_trigger.php b/backend/migrations/m220515_004033_create_tau_headshot_trigger.php
deleted file mode 100644
index 08e30b9d4..000000000
--- a/backend/migrations/m220515_004033_create_tau_headshot_trigger.php
+++ /dev/null
@@ -1,32 +0,0 @@
--1) WHERE id=NEW.target_id;
- END IF;
-
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220515_124225_create_tai_network_target_trigger.php b/backend/migrations/m220515_124225_create_tai_network_target_trigger.php
deleted file mode 100644
index ce3d0a451..000000000
--- a/backend/migrations/m220515_124225_create_tai_network_target_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220515_124231_create_tad_network_target_trigger.php b/backend/migrations/m220515_124231_create_tad_network_target_trigger.php
deleted file mode 100644
index 589fa1eaa..000000000
--- a/backend/migrations/m220515_124231_create_tad_network_target_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220515_124637_create_tai_target_ondemand_trigger.php b/backend/migrations/m220515_124637_create_tai_target_ondemand_trigger.php
deleted file mode 100644
index 6afbe63b3..000000000
--- a/backend/migrations/m220515_124637_create_tai_target_ondemand_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220515_124644_create_tad_target_ondemand_trigger.php b/backend/migrations/m220515_124644_create_tad_target_ondemand_trigger.php
deleted file mode 100644
index 02367e477..000000000
--- a/backend/migrations/m220515_124644_create_tad_target_ondemand_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220515_124707_create_tau_target_ondemand_trigger.php b/backend/migrations/m220515_124707_create_tau_target_ondemand_trigger.php
deleted file mode 100644
index cb739d774..000000000
--- a/backend/migrations/m220515_124707_create_tau_target_ondemand_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220515_203039_create_target_player_state_table.php b/backend/migrations/m220515_203039_create_target_player_state_table.php
deleted file mode 100644
index a680286d5..000000000
--- a/backend/migrations/m220515_203039_create_target_player_state_table.php
+++ /dev/null
@@ -1,62 +0,0 @@
-createTable('{{%target_player_state}}', [
- 'id' => $this->integer()->notNull(),
- 'player_id' => $this->integer()->unsigned()->notNull(),
- 'player_treasures' => $this->integer()->notNull()->defaultValue(0),
- 'player_findings'=> $this->integer()->notNull()->defaultValue(0),
- 'player_points'=> $this->integer()->notNull()->defaultValue(0),
- 'PRIMARY KEY (id,player_id)',
- ]);
-
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-target_player_state-id}}',
- '{{%target_player_state}}',
- 'id',
- '{{%target}}',
- 'id',
- 'CASCADE'
- );
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-target_player_state-player_id}}',
- '{{%target_player_state}}',
- 'player_id',
- '{{%player}}',
- 'id',
- 'CASCADE'
- );
-
- $this->createIndex(
- 'idx-target_player_state-player_treasures',
- 'target_player_state',
- 'player_treasures'
- );
- $this->createIndex(
- 'idx-target_player_state-player_findings',
- 'target_player_state',
- 'player_findings'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%target_player_state}}');
- }
-}
diff --git a/backend/migrations/m220515_203600_populate_target_player_state_with_data.php b/backend/migrations/m220515_203600_populate_target_player_state_with_data.php
deleted file mode 100644
index 0fa2d7c94..000000000
--- a/backend/migrations/m220515_203600_populate_target_player_state_with_data.php
+++ /dev/null
@@ -1,27 +0,0 @@
-db->createCommand("INSERT INTO target_player_state (id,player_id,player_points,player_treasures) select target_id,player_id,sum(t1.points),count(*) from player_treasure as t1 left join treasure as t2 on t1.treasure_id=t2.id group by target_id,player_id")->execute();
- $this->db->createCommand("INSERT INTO target_player_state (id,player_id,player_points,player_findings) select target_id,player_id,sum(t1.points),count(*) from player_finding as t1 left join finding as t2 on t1.finding_id=t2.id group by target_id,player_id ON DUPLICATE KEY UPDATE player_findings=values(player_findings),player_points=player_points+values(player_points)")->execute();
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "m220515_203600_populate_target_player_state_with_data cannot be reverted.\n";
-
- }
-}
diff --git a/backend/migrations/m220515_204708_update_tai_player_treasure_trigger.php b/backend/migrations/m220515_204708_update_tai_player_treasure_trigger.php
deleted file mode 100644
index 86fe094e0..000000000
--- a/backend/migrations/m220515_204708_update_tai_player_treasure_trigger.php
+++ /dev/null
@@ -1,47 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220515_205422_update_tai_player_finding_trigger.php b/backend/migrations/m220515_205422_update_tai_player_finding_trigger.php
deleted file mode 100644
index e0211dac6..000000000
--- a/backend/migrations/m220515_205422_update_tai_player_finding_trigger.php
+++ /dev/null
@@ -1,51 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220521_205918_alter_player_ssl_table_drop_column_txtcrt.php b/backend/migrations/m220521_205918_alter_player_ssl_table_drop_column_txtcrt.php
deleted file mode 100644
index 5260f19e3..000000000
--- a/backend/migrations/m220521_205918_alter_player_ssl_table_drop_column_txtcrt.php
+++ /dev/null
@@ -1,25 +0,0 @@
-dropColumn('player_ssl', 'txtcrt');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->addColumn('player_ssl', 'txtcrt', 'MEDIUMTEXT NOT NULL');
- }
-}
diff --git a/backend/migrations/m220521_210518_update_tau_player_ssl_trigger_remove_txtcrt_column.php b/backend/migrations/m220521_210518_update_tau_player_ssl_trigger_remove_txtcrt_column.php
deleted file mode 100644
index ffffb4dd8..000000000
--- a/backend/migrations/m220521_210518_update_tau_player_ssl_trigger_remove_txtcrt_column.php
+++ /dev/null
@@ -1,32 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220521_210953_alter_crl_table_drop_column_txtcrt.php b/backend/migrations/m220521_210953_alter_crl_table_drop_column_txtcrt.php
deleted file mode 100644
index 5bb8dd834..000000000
--- a/backend/migrations/m220521_210953_alter_crl_table_drop_column_txtcrt.php
+++ /dev/null
@@ -1,25 +0,0 @@
-dropColumn('crl', 'txtcrt');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->addColumn('crl', 'txtcrt', 'MEDIUMTEXT NOT NULL');
- }
-}
diff --git a/backend/migrations/m220522_232612_update_tad_player_ssl_trigger_remove_txtcrt.php b/backend/migrations/m220522_232612_update_tad_player_ssl_trigger_remove_txtcrt.php
deleted file mode 100644
index 82d6910b7..000000000
--- a/backend/migrations/m220522_232612_update_tad_player_ssl_trigger_remove_txtcrt.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
- }
diff --git a/backend/migrations/m220528_091710_create_network_target_schedule_table.php b/backend/migrations/m220528_091710_create_network_target_schedule_table.php
deleted file mode 100644
index 9ed4c4f03..000000000
--- a/backend/migrations/m220528_091710_create_network_target_schedule_table.php
+++ /dev/null
@@ -1,95 +0,0 @@
-createTable('{{%network_target_schedule}}', [
- 'id' => $this->primaryKey(),
- 'target_id' => $this->integer()->notNull(),
- 'network_id' => $this->integer(),
- 'migration_date' => $this->dateTime()->notNull(),
- 'created_at' => $this->dateTime()->notNull(),
- 'updated_at' => $this->timestamp()->notNull(),
- ]);
-
- // creates index for column `target_id`
- $this->createIndex(
- '{{%idx-network_target_schedule-target_id}}',
- '{{%network_target_schedule}}',
- 'target_id'
- );
-
- // add foreign key for table `{{%target}}`
- $this->addForeignKey(
- '{{%fk-network_target_schedule-target_id}}',
- '{{%network_target_schedule}}',
- 'target_id',
- '{{%target}}',
- 'id',
- 'CASCADE'
- );
-
- // creates index for column `network_id`
- $this->createIndex(
- '{{%idx-network_target_schedule-network_id}}',
- '{{%network_target_schedule}}',
- 'network_id'
- );
-
- // add foreign key for table `{{%network}}`
- $this->addForeignKey(
- '{{%fk-network_target_schedule-network_id}}',
- '{{%network_target_schedule}}',
- 'network_id',
- '{{%network}}',
- 'id',
- 'SET NULL',
- 'CASCADE'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- // drops foreign key for table `{{%target}}`
- $this->dropForeignKey(
- '{{%fk-network_target_schedule-target_id}}',
- '{{%network_target_schedule}}'
- );
-
- // drops index for column `target_id`
- $this->dropIndex(
- '{{%idx-network_target_schedule-target_id}}',
- '{{%network_target_schedule}}'
- );
-
- // drops foreign key for table `{{%network}}`
- $this->dropForeignKey(
- '{{%fk-network_target_schedule-network_id}}',
- '{{%network_target_schedule}}'
- );
-
- // drops index for column `network_id`
- $this->dropIndex(
- '{{%idx-network_target_schedule-network_id}}',
- '{{%network_target_schedule}}'
- );
-
- $this->dropTable('{{%network_target_schedule}}');
- }
-}
diff --git a/backend/migrations/m220530_213836_update_tai_headshot_trigger_schedule_ondemand.php b/backend/migrations/m220530_213836_update_tai_headshot_trigger_schedule_ondemand.php
deleted file mode 100644
index 68f38d17d..000000000
--- a/backend/migrations/m220530_213836_update_tai_headshot_trigger_schedule_ondemand.php
+++ /dev/null
@@ -1,35 +0,0 @@
-0 THEN
- INSERT IGNORE INTO spin_queue (target_id, player_id,created_at) VALUES (NEW.target_id,NEW.player_id,NOW());
- END IF;
- IF (SELECT count(*) FROM target_ondemand WHERE target_id=NEW.target_id AND state=1)>0 THEN
- UPDATE target_ondemand SET heartbeat=(NOW() - INTERVAL 59 MINUTE - INTERVAL 30 SECOND) WHERE target_id=NEW.target_id;
- END IF;
- UPDATE target_state SET total_headshots=total_headshots+1,timer_avg=(SELECT round(avg(timer)) FROM headshot WHERE target_id=NEW.target_id) WHERE id=NEW.target_id;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220531_111646_update_tai_target_add_target_state.php b/backend/migrations/m220531_111646_update_tai_target_add_target_state.php
deleted file mode 100644
index 21f45fb80..000000000
--- a/backend/migrations/m220531_111646_update_tai_target_add_target_state.php
+++ /dev/null
@@ -1,35 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220607_093340_create_time_headshot_with_player.php b/backend/migrations/m220607_093340_create_time_headshot_with_player.php
deleted file mode 100644
index 189b727d7..000000000
--- a/backend/migrations/m220607_093340_create_time_headshot_with_player.php
+++ /dev/null
@@ -1,30 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
- }
diff --git a/backend/migrations/m220607_103806_update_tau_headshot_trigger_timer_avg.php b/backend/migrations/m220607_103806_update_tau_headshot_trigger_timer_avg.php
deleted file mode 100644
index b510bcca7..000000000
--- a/backend/migrations/m220607_103806_update_tau_headshot_trigger_timer_avg.php
+++ /dev/null
@@ -1,34 +0,0 @@
--1) WHERE id=NEW.target_id;
- END IF;
- IF (OLD.timer IS NULL AND NEW.timer IS NOT NULL) OR (OLD.timer IS NOT NULL AND NEW.timer!=OLD.timer) THEN
- UPDATE target_state SET timer_avg=(SELECT round(avg(timer)) FROM headshot WHERE target_id=NEW.target_id and timer>60) WHERE id=NEW.target_id;
- END IF;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220619_171820_create_layout_override_table.php b/backend/migrations/m220619_171820_create_layout_override_table.php
deleted file mode 100644
index 2a0c4e5e7..000000000
--- a/backend/migrations/m220619_171820_create_layout_override_table.php
+++ /dev/null
@@ -1,36 +0,0 @@
-createTable('{{%layout_override}}', [
- 'id' => $this->primaryKey(),
- 'name' => $this->string()->notNull(),
- 'route' => $this->string(),
- 'guest' => $this->boolean()->notNull()->defaultValue(0),
- 'player_id' => $this->integer(),
- 'css' => $this->text(),
- 'js' => $this->text(),
- 'repeating' => $this->boolean()->notNull()->defaultValue(0),
- 'valid_from' => $this->dateTime()->notNull(),
- 'valid_until' => $this->dateTime()->notNull(),
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%layout_override}}');
- }
-}
diff --git a/backend/migrations/m220707_161412_tad_finding_fix.php b/backend/migrations/m220707_161412_tad_finding_fix.php
deleted file mode 100644
index 97de698bb..000000000
--- a/backend/migrations/m220707_161412_tad_finding_fix.php
+++ /dev/null
@@ -1,36 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220707_161603_tad_headshot_fix.php b/backend/migrations/m220707_161603_tad_headshot_fix.php
deleted file mode 100644
index f40f87aac..000000000
--- a/backend/migrations/m220707_161603_tad_headshot_fix.php
+++ /dev/null
@@ -1,30 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220707_161655_tad_treasure_fix.php b/backend/migrations/m220707_161655_tad_treasure_fix.php
deleted file mode 100644
index 189bc1d8d..000000000
--- a/backend/migrations/m220707_161655_tad_treasure_fix.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220707_164214_update_tai_headshot_trigger_state_null.php b/backend/migrations/m220707_164214_update_tai_headshot_trigger_state_null.php
deleted file mode 100644
index a95c3ace6..000000000
--- a/backend/migrations/m220707_164214_update_tai_headshot_trigger_state_null.php
+++ /dev/null
@@ -1,35 +0,0 @@
-0 THEN
- INSERT IGNORE INTO spin_queue (target_id, player_id,created_at) VALUES (NEW.target_id,NEW.player_id,NOW());
- END IF;
- IF (SELECT count(*) FROM target_ondemand WHERE target_id=NEW.target_id AND state=1)>0 THEN
- UPDATE target_ondemand SET heartbeat=(NOW() - INTERVAL 59 MINUTE - INTERVAL 30 SECOND) WHERE target_id=NEW.target_id;
- END IF;
- UPDATE target_state SET total_headshots=total_headshots+1,timer_avg=(SELECT ifnull(round(avg(timer)),0) FROM headshot WHERE target_id=NEW.target_id) WHERE id=NEW.target_id;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m220707_170244_tbd_target.php b/backend/migrations/m220707_170244_tbd_target.php
deleted file mode 100644
index d2d544a7e..000000000
--- a/backend/migrations/m220707_170244_tbd_target.php
+++ /dev/null
@@ -1,32 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m221021_160627_add_subscription_cancel_urlrules.php b/backend/migrations/m221021_160627_add_subscription_cancel_urlrules.php
deleted file mode 100644
index bea895a4e..000000000
--- a/backend/migrations/m221021_160627_add_subscription_cancel_urlrules.php
+++ /dev/null
@@ -1,25 +0,0 @@
-upsert('url_route',['source'=>'subscription/cancel','destination'=>'subscription/default/cancel-subscription','weight'=>705]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->delete('url_route',['source'=>'subscription/cancel','destination'=>'subscription/default/cancel-subscription']);
- }
-}
diff --git a/backend/migrations/m221031_075751_update_tau_target_instance_trigger_limit_audit_records.php b/backend/migrations/m221031_075751_update_tau_target_instance_trigger_limit_audit_records.php
deleted file mode 100644
index d2467562f..000000000
--- a/backend/migrations/m221031_075751_update_tau_target_instance_trigger_limit_audit_records.php
+++ /dev/null
@@ -1,39 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m221114_011301_add_instance_allowed_column_to_target_table.php b/backend/migrations/m221114_011301_add_instance_allowed_column_to_target_table.php
deleted file mode 100644
index 17c026f11..000000000
--- a/backend/migrations/m221114_011301_add_instance_allowed_column_to_target_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%target}}', 'instance_allowed', $this->smallInteger()->defaultValue(1));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%target}}', 'instance_allowed');
- }
-}
diff --git a/backend/migrations/m221215_212831_update_tai_sysconfig_serialize_json_all.php b/backend/migrations/m221215_212831_update_tai_sysconfig_serialize_json_all.php
deleted file mode 100644
index c59eb4b83..000000000
--- a/backend/migrations/m221215_212831_update_tai_sysconfig_serialize_json_all.php
+++ /dev/null
@@ -1,34 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m221215_212839_update_tad_sysconfig_serialize_json_all.php b/backend/migrations/m221215_212839_update_tad_sysconfig_serialize_json_all.php
deleted file mode 100644
index 15d098ccb..000000000
--- a/backend/migrations/m221215_212839_update_tad_sysconfig_serialize_json_all.php
+++ /dev/null
@@ -1,34 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m221215_212842_update_tau_sysconfig_serialize_json_all.php b/backend/migrations/m221215_212842_update_tau_sysconfig_serialize_json_all.php
deleted file mode 100644
index ea00a25eb..000000000
--- a/backend/migrations/m221215_212842_update_tau_sysconfig_serialize_json_all.php
+++ /dev/null
@@ -1,36 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m221215_214626_update_populate_memcache_procedure_include_serialized_sysconfig.php b/backend/migrations/m221215_214626_update_populate_memcache_procedure_include_serialized_sysconfig.php
deleted file mode 100644
index b3cfb1e27..000000000
--- a/backend/migrations/m221215_214626_update_populate_memcache_procedure_include_serialized_sysconfig.php
+++ /dev/null
@@ -1,36 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m221219_213856_add_announce_column_to_network_table.php b/backend/migrations/m221219_213856_add_announce_column_to_network_table.php
deleted file mode 100644
index 8199bffa6..000000000
--- a/backend/migrations/m221219_213856_add_announce_column_to_network_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%network}}', 'announce', $this->boolean()->defaultValue(1)->after('active'));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%network}}', 'announce');
- }
-}
diff --git a/backend/migrations/m230107_123003_add_category_column_to_notification_table.php b/backend/migrations/m230107_123003_add_category_column_to_notification_table.php
deleted file mode 100644
index 557f4b64a..000000000
--- a/backend/migrations/m230107_123003_add_category_column_to_notification_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%notification}}', 'category', $this->string(20)->notNull()->defaultValue('success')->after('player_id'));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%notification}}', 'category');
- }
-}
diff --git a/backend/migrations/m230107_232912_add_index_to_archived_and_category_columns_on_notification.php b/backend/migrations/m230107_232912_add_index_to_archived_and_category_columns_on_notification.php
deleted file mode 100644
index a7b51965a..000000000
--- a/backend/migrations/m230107_232912_add_index_to_archived_and_category_columns_on_notification.php
+++ /dev/null
@@ -1,57 +0,0 @@
-createIndex(
- 'idx-notification-archived',
- 'notification',
- 'archived'
- );
- $this->createIndex(
- 'idx-notification-category',
- 'notification',
- 'category'
- );
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropIndex(
- 'idx-notification-archived',
- 'notification'
- );
- $this->dropIndex(
- 'idx-notification-category',
- 'notification'
- );
- }
-
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
-
- }
-
- public function down()
- {
- echo "m230107_232912_add_index_to_archived_and_category_columns_on_notification cannot be reverted.\n";
-
- return false;
- }
- */
-}
diff --git a/backend/migrations/m230109_180919_add_api_notification_url_route.php b/backend/migrations/m230109_180919_add_api_notification_url_route.php
deleted file mode 100644
index 0702ac305..000000000
--- a/backend/migrations/m230109_180919_add_api_notification_url_route.php
+++ /dev/null
@@ -1,40 +0,0 @@
-upsert('url_route',['source'=>'api/notification','destination'=>'api/notification/index','weight'=>641]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "m230109_180919_add_api_notification_url_route cannot be reverted.\n";
- }
-
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
-
- }
-
- public function down()
- {
- echo "m230109_180919_add_api_notification_url_route cannot be reverted.\n";
-
- return false;
- }
- */
-}
diff --git a/backend/migrations/m230110_182919_create_pages_table.php b/backend/migrations/m230110_182919_create_pages_table.php
deleted file mode 100644
index 36fe0ddbc..000000000
--- a/backend/migrations/m230110_182919_create_pages_table.php
+++ /dev/null
@@ -1,32 +0,0 @@
-createTable('{{%pages}}', [
- 'id' => $this->primaryKey(),
- 'metatags'=>$this->text(),
- 'title' => $this->string(),
- 'body' => 'LONGTEXT',
- 'created_at' => $this->dateTime(),
- 'updated_at' => $this->dateTime(),
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%pages}}');
- }
-}
diff --git a/backend/migrations/m230131_120635_add_guest_column_to_network_table.php b/backend/migrations/m230131_120635_add_guest_column_to_network_table.php
deleted file mode 100644
index ee5cb3963..000000000
--- a/backend/migrations/m230131_120635_add_guest_column_to_network_table.php
+++ /dev/null
@@ -1,40 +0,0 @@
-addColumn('{{%network}}', 'guest', $this->boolean()->notNull()->defaultValue(0)->after('public'));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%network}}', 'guest');
- }
-
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
-
- }
-
- public function down()
- {
- echo "m230131_120635_add_guest_columnt_to_network_table cannot be reverted.\n";
-
- return false;
- }
- */
-}
diff --git a/backend/migrations/m230131_174555_create_credits_table.php b/backend/migrations/m230131_174555_create_credits_table.php
deleted file mode 100644
index 9766d3374..000000000
--- a/backend/migrations/m230131_174555_create_credits_table.php
+++ /dev/null
@@ -1,32 +0,0 @@
-createTable('{{%credits}}', [
- 'id' => $this->primaryKey(),
- 'title' => $this->string()->notNull(),
- 'body' => $this->text(),
- 'weight'=>$this->integer()->defaultValue(0),
- 'created_at' => $this->dateTime(),
- 'updated_at' => $this->dateTime(),
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%credits}}');
- }
-}
diff --git a/backend/migrations/m230203_223558_update_tai_headshot_trigger_private_instances.php b/backend/migrations/m230203_223558_update_tai_headshot_trigger_private_instances.php
deleted file mode 100644
index 04916d9e8..000000000
--- a/backend/migrations/m230203_223558_update_tai_headshot_trigger_private_instances.php
+++ /dev/null
@@ -1,39 +0,0 @@
-0 AND private_instance<1 THEN
- INSERT IGNORE INTO spin_queue (target_id, player_id,created_at) VALUES (NEW.target_id,NEW.player_id,NOW());
- ELSEIF private_instance>0 THEN
- UPDATE target_instance SET reboot=2 WHERE player_id=NEW.player_id AND target_id=NEW.target_id;
- END IF;
- IF (SELECT count(*) FROM target_ondemand WHERE target_id=NEW.target_id AND state=1)>0 THEN
- UPDATE target_ondemand SET heartbeat=(NOW() - INTERVAL 59 MINUTE - INTERVAL 30 SECOND) WHERE target_id=NEW.target_id;
- END IF;
- UPDATE target_state SET total_headshots=total_headshots+1,timer_avg=(SELECT ifnull(round(avg(timer)),0) FROM headshot WHERE target_id=NEW.target_id) WHERE id=NEW.target_id;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m230224_103953_update_tad_player_trigger_to_clean_scores.php b/backend/migrations/m230224_103953_update_tad_player_trigger_to_clean_scores.php
deleted file mode 100644
index f12ee8ffe..000000000
--- a/backend/migrations/m230224_103953_update_tad_player_trigger_to_clean_scores.php
+++ /dev/null
@@ -1,40 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m230307_091159_add_require_findings_column_to_target_table.php b/backend/migrations/m230307_091159_add_require_findings_column_to_target_table.php
deleted file mode 100644
index 55f5a47f0..000000000
--- a/backend/migrations/m230307_091159_add_require_findings_column_to_target_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%target}}', 'require_findings', $this->boolean()->defaultValue(0));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%target}}', 'require_findings');
- }
-}
diff --git a/backend/migrations/m230314_134156_version_bumb_v0_23_0.php b/backend/migrations/m230314_134156_version_bumb_v0_23_0.php
deleted file mode 100644
index 6934ac0e2..000000000
--- a/backend/migrations/m230314_134156_version_bumb_v0_23_0.php
+++ /dev/null
@@ -1,26 +0,0 @@
-update('sysconfig', ['val'=>'v0.23.0'], ['id'=>'platform_version']);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->update('sysconfig', ['val'=>'v0.22.0'], ['id'=>'platform_version']);
- }
-
-}
diff --git a/backend/migrations/m230322_215400_create_rotate_notifications_procedure.php b/backend/migrations/m230322_215400_create_rotate_notifications_procedure.php
deleted file mode 100644
index e460b0d11..000000000
--- a/backend/migrations/m230322_215400_create_rotate_notifications_procedure.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m230322_215432_update_rotate_notifications_event.php b/backend/migrations/m230322_215432_update_rotate_notifications_event.php
deleted file mode 100644
index 2636638f2..000000000
--- a/backend/migrations/m230322_215432_update_rotate_notifications_event.php
+++ /dev/null
@@ -1,30 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m230729_200303_update_tbd_player_delete_team_data.php b/backend/migrations/m230729_200303_update_tbd_player_delete_team_data.php
deleted file mode 100644
index 8599c7770..000000000
--- a/backend/migrations/m230729_200303_update_tbd_player_delete_team_data.php
+++ /dev/null
@@ -1,35 +0,0 @@
- 0 THEN
- DELETE FROM team_score WHERE team_id=tid;
- END IF;
- DELETE FROM player_ssl WHERE player_id=OLD.id;
- DELETE FROM player_rank WHERE player_id=OLD.id;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m230730_100249_add_echoctf_column_to_profile_table.php b/backend/migrations/m230730_100249_add_echoctf_column_to_profile_table.php
deleted file mode 100644
index 35d764c12..000000000
--- a/backend/migrations/m230730_100249_add_echoctf_column_to_profile_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%profile}}', 'echoctf', $this->integer()->unsigned()->after('twitch'));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%profile}}', 'echoctf');
- }
-}
diff --git a/backend/migrations/m230813_215403_create_tad_challenge_trigger.php b/backend/migrations/m230813_215403_create_tad_challenge_trigger.php
deleted file mode 100644
index 573ef400a..000000000
--- a/backend/migrations/m230813_215403_create_tad_challenge_trigger.php
+++ /dev/null
@@ -1,30 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m230813_215914_create_tbd_challenge_trigger.php b/backend/migrations/m230813_215914_create_tbd_challenge_trigger.php
deleted file mode 100644
index 7c5d7ddf6..000000000
--- a/backend/migrations/m230813_215914_create_tbd_challenge_trigger.php
+++ /dev/null
@@ -1,30 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m230813_220358_create_tad_stream_trigger.php b/backend/migrations/m230813_220358_create_tad_stream_trigger.php
deleted file mode 100644
index 5df34ac00..000000000
--- a/backend/migrations/m230813_220358_create_tad_stream_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m230814_110341_create_tad_team_stream_trigger.php b/backend/migrations/m230814_110341_create_tad_team_stream_trigger.php
deleted file mode 100644
index 1d3cb2340..000000000
--- a/backend/migrations/m230814_110341_create_tad_team_stream_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m230826_200413_add_team_allowed_column_to_target_instance_table.php b/backend/migrations/m230826_200413_add_team_allowed_column_to_target_instance_table.php
deleted file mode 100644
index c3bf1176f..000000000
--- a/backend/migrations/m230826_200413_add_team_allowed_column_to_target_instance_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%target_instance}}', 'team_allowed', $this->boolean()->notNull()->defaultValue(false));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%target_instance}}', 'team_allowed');
- }
-}
diff --git a/backend/migrations/m230826_203504_add_team_allowed_column_to_target_instance_audit_table.php b/backend/migrations/m230826_203504_add_team_allowed_column_to_target_instance_audit_table.php
deleted file mode 100644
index 364dfae9a..000000000
--- a/backend/migrations/m230826_203504_add_team_allowed_column_to_target_instance_audit_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%target_instance_audit}}', 'team_allowed', $this->boolean()->notNull()->defaultValue(false));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%target_instance_audit}}', 'team_allowed');
- }
-}
diff --git a/backend/migrations/m230826_212155_add_ssl_and_timeout_columns_to_server_table.php b/backend/migrations/m230826_212155_add_ssl_and_timeout_columns_to_server_table.php
deleted file mode 100644
index cf6429203..000000000
--- a/backend/migrations/m230826_212155_add_ssl_and_timeout_columns_to_server_table.php
+++ /dev/null
@@ -1,27 +0,0 @@
-addColumn('{{%server}}', 'ssl', $this->boolean()->notNull()->defaultValue(false));
- $this->addColumn('{{%server}}', 'timeout', $this->integer()->notNull()->defaultValue(9000));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%server}}', 'ssl');
- $this->dropColumn('{{%server}}', 'timeout');
- }
-}
diff --git a/backend/migrations/m230827_161057_update_tai_target_instance_trigger_add_team_allowed.php b/backend/migrations/m230827_161057_update_tai_target_instance_trigger_add_team_allowed.php
deleted file mode 100644
index 73b0b132a..000000000
--- a/backend/migrations/m230827_161057_update_tai_target_instance_trigger_add_team_allowed.php
+++ /dev/null
@@ -1,32 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
- }
diff --git a/backend/migrations/m230827_161204_update_tau_target_instance_trigger_add_team_allowed.php b/backend/migrations/m230827_161204_update_tau_target_instance_trigger_add_team_allowed.php
deleted file mode 100644
index 87bf8e698..000000000
--- a/backend/migrations/m230827_161204_update_tau_target_instance_trigger_add_team_allowed.php
+++ /dev/null
@@ -1,39 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
- }
diff --git a/backend/migrations/m230827_161324_update_tad_target_instance_trigger_add_team_allowed.php b/backend/migrations/m230827_161324_update_tad_target_instance_trigger_add_team_allowed.php
deleted file mode 100644
index 76473663d..000000000
--- a/backend/migrations/m230827_161324_update_tad_target_instance_trigger_add_team_allowed.php
+++ /dev/null
@@ -1,32 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m231101_114257_update_tad_team_trigger_fix_order.php b/backend/migrations/m231101_114257_update_tad_team_trigger_fix_order.php
deleted file mode 100644
index 6dc044255..000000000
--- a/backend/migrations/m231101_114257_update_tad_team_trigger_fix_order.php
+++ /dev/null
@@ -1,32 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m231101_205544_add_unique_to_title_faq.php b/backend/migrations/m231101_205544_add_unique_to_title_faq.php
deleted file mode 100644
index 096689bdf..000000000
--- a/backend/migrations/m231101_205544_add_unique_to_title_faq.php
+++ /dev/null
@@ -1,31 +0,0 @@
-createIndex(
- 'unique_faq_title',
- '{{%faq}}',
- 'title',
- true
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropIndex('unique_faq_title','faq');
- }
-
-}
diff --git a/backend/migrations/m231102_081144_create_team_audit_table.php b/backend/migrations/m231102_081144_create_team_audit_table.php
deleted file mode 100644
index 596528358..000000000
--- a/backend/migrations/m231102_081144_create_team_audit_table.php
+++ /dev/null
@@ -1,36 +0,0 @@
-createTable('{{%team_audit}}', [
- 'id' => $this->primaryKey(),
- 'team_id' => $this->integer()->notNull(),
- 'player_id' => $this->integer(),
- 'action' => $this->string(20)->notNull()->defaultValue('default'),
- 'message' => $this->text(),
- 'ts' => $this->timestamp(),
- ]);
- $this->createIndex('team_id_idx','{{%team_audit}}','team_id');
- $this->createIndex('player_id_idx','{{%team_audit}}','player_id');
- $this->createIndex('action_idx','{{%team_audit}}','action');
- $this->createIndex('ts_idx','{{%team_audit}}','ts');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%team_audit}}');
- }
-}
diff --git a/backend/migrations/m231102_085411_create_tai_team_player_trigger.php b/backend/migrations/m231102_085411_create_tai_team_player_trigger.php
deleted file mode 100644
index 7dd854608..000000000
--- a/backend/migrations/m231102_085411_create_tai_team_player_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m231102_085421_create_tau_team_player_trigger.php b/backend/migrations/m231102_085421_create_tau_team_player_trigger.php
deleted file mode 100644
index 057aa7a71..000000000
--- a/backend/migrations/m231102_085421_create_tau_team_player_trigger.php
+++ /dev/null
@@ -1,35 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m231102_085728_create_tad_team_player_trigger.php b/backend/migrations/m231102_085728_create_tad_team_player_trigger.php
deleted file mode 100644
index 3a4a64c00..000000000
--- a/backend/migrations/m231102_085728_create_tad_team_player_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m231102_093631_create_tai_team_trigger.php b/backend/migrations/m231102_093631_create_tai_team_trigger.php
deleted file mode 100644
index ae4eee720..000000000
--- a/backend/migrations/m231102_093631_create_tai_team_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m231102_094132_create_tau_team_trigger.php b/backend/migrations/m231102_094132_create_tau_team_trigger.php
deleted file mode 100644
index b060c9744..000000000
--- a/backend/migrations/m231102_094132_create_tau_team_trigger.php
+++ /dev/null
@@ -1,51 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m231103_205532_add_created_at_and_updated_at_column_to_target_player_state_table.php b/backend/migrations/m231103_205532_add_created_at_and_updated_at_column_to_target_player_state_table.php
deleted file mode 100644
index a66f4ebb4..000000000
--- a/backend/migrations/m231103_205532_add_created_at_and_updated_at_column_to_target_player_state_table.php
+++ /dev/null
@@ -1,27 +0,0 @@
-addColumn('{{%target_player_state}}', 'created_at', $this->dateTime());
- $this->addColumn('{{%target_player_state}}', 'updated_at', $this->dateTime());
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%target_player_state}}', 'created_at');
- $this->dropColumn('{{%target_player_state}}', 'updated_at');
- }
-}
diff --git a/backend/migrations/m231104_191348_update_tai_player_treasure_add_created_and_updated_at_to_state.php b/backend/migrations/m231104_191348_update_tai_player_treasure_add_created_and_updated_at_to_state.php
deleted file mode 100644
index 932a425e3..000000000
--- a/backend/migrations/m231104_191348_update_tai_player_treasure_add_created_and_updated_at_to_state.php
+++ /dev/null
@@ -1,47 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m231104_191359_update_tai_player_finding_add_created_and_updated_at_to_state.php b/backend/migrations/m231104_191359_update_tai_player_finding_add_created_and_updated_at_to_state.php
deleted file mode 100644
index a3cea15bd..000000000
--- a/backend/migrations/m231104_191359_update_tai_player_finding_add_created_and_updated_at_to_state.php
+++ /dev/null
@@ -1,51 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m231104_223328_update_target_player_state_created_at_and_updated_at.php b/backend/migrations/m231104_223328_update_target_player_state_created_at_and_updated_at.php
deleted file mode 100644
index 7e5553ce2..000000000
--- a/backend/migrations/m231104_223328_update_target_player_state_created_at_and_updated_at.php
+++ /dev/null
@@ -1,86 +0,0 @@
- $two)
- return $one;
-
- return $two;
- }
-
- private function minimum($one, $two)
- {
- if ($one == null && $two == null)
- return null;
- if ($one == null)
- return $two;
- if ($two == null)
- return $one;
- if ($one < $two)
- return $one;
-
- return $two;
- }
-
- /**
- * {@inheritdoc}
- */
- public function up()
- {
- // foreach target_player_state
- foreach ((new Query)->from('target_player_state')->each() as $tps) {
- // get list of treasure_ids
- // get list of finding_ids
- $finding_ids = Yii::$app->db->createCommand("SELECT group_concat(id) as ids from finding WHERE target_id=:target_id group by target_id")->bindValue(':target_id', $tps['id'])->queryScalar();
- $treasure_ids = Yii::$app->db->createCommand("SELECT group_concat(id) as ids from treasure WHERE target_id=:target_id group by target_id")->bindValue(':target_id', $tps['id'])->queryScalar();
- // get min/max ts from player_finding
- // get min/max ts from player_treasure
- $mm_findings = Yii::$app->db->createCommand("SELECT UNIX_TIMESTAMP(min(ts)) as min_ts, UNIX_TIMESTAMP(max(ts)) as max_ts FROM player_finding WHERE player_id=:player_id AND finding_id in ($finding_ids)")->bindValue(':player_id', $tps['player_id'])->queryAll();
- $mm_treasures = Yii::$app->db->createCommand("SELECT UNIX_TIMESTAMP(min(ts)) as min_ts, UNIX_TIMESTAMP(max(ts)) as max_ts FROM player_treasure WHERE player_id=:player_id AND treasure_id in ($treasure_ids)")->bindValue(':player_id', $tps['player_id'])->queryAll();
- $min = $this->minimum($mm_findings[0]['min_ts'], $mm_treasures[0]['min_ts']);
- $max = $this->maximum($mm_findings[0]['max_ts'], $mm_treasures[0]['max_ts']);
-// echo "player_id=>",$tps['player_id']," target_id=>",$tps['id']," min=>",$min," max=>",$max,"\n";
- $this->db->createCommand("UPDATE target_player_state SET created_at=from_unixtime($min), updated_at=from_unixtime($max) WHERE id=:id AND player_id=:player_id")
- ->bindValue(":id",$tps['id'])
- ->bindValue(":player_id",$tps['player_id'])
- ->execute();
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function down()
- {
- echo "m231104_223328_update_target_player_state_created_at_and_updated_at cannot be reverted.\n";
- }
-
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
-
- }
-
- public function down()
- {
- echo "m231104_223328_update_target_player_state_created_at_and_updated_at cannot be reverted.\n";
-
- return false;
- }
- */
-}
diff --git a/backend/migrations/m240320_235210_add_server_column_to_openvpn_table.php b/backend/migrations/m240320_235210_add_server_column_to_openvpn_table.php
deleted file mode 100644
index 39b8ee733..000000000
--- a/backend/migrations/m240320_235210_add_server_column_to_openvpn_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%openvpn}}', 'server', $this->string()->after('id'));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%openvpn}}', 'server');
- }
-}
diff --git a/backend/migrations/m240320_235211_alter_openvpn_table_unique_keys.php b/backend/migrations/m240320_235211_alter_openvpn_table_unique_keys.php
deleted file mode 100644
index 4027d158d..000000000
--- a/backend/migrations/m240320_235211_alter_openvpn_table_unique_keys.php
+++ /dev/null
@@ -1,31 +0,0 @@
-dropIndex('name', 'openvpn');
- $this->dropIndex('net', 'openvpn');
- $this->createIndex('server_name_net', 'openvpn', ['server','name','net'], true );
-
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropIndex('server_name_net', 'openvpn');
- $this->createIndex('name', 'openvpn', ['name'], true );
- $this->createIndex('net', 'openvpn', ['name'], true );
- }
-}
diff --git a/backend/migrations/m240418_224927_update_existing_discord_link_entries.php b/backend/migrations/m240418_224927_update_existing_discord_link_entries.php
deleted file mode 100644
index 8ff6c8a31..000000000
--- a/backend/migrations/m240418_224927_update_existing_discord_link_entries.php
+++ /dev/null
@@ -1,34 +0,0 @@
-sys->discord_invite_url!==false && Yii::$app->sys->discord_invite_url!=="")
- {
- $link=json_encode([
- [
- 'name'=>'Join our Discord!
',
- 'link'=>Yii::$app->sys->discord_invite_url
- ]
- ]);
- $this->update('sysconfig',['val'=>$link,'id'=>'menu_items'],['id'=>'discord_invite_url']);
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "m240418_224927_update_existing_discord_link_entries cannot be reverted.\n";
- }
-}
diff --git a/backend/migrations/m240420_224025_add_slug_column_to_pages_table.php b/backend/migrations/m240420_224025_add_slug_column_to_pages_table.php
deleted file mode 100644
index a52f85904..000000000
--- a/backend/migrations/m240420_224025_add_slug_column_to_pages_table.php
+++ /dev/null
@@ -1,27 +0,0 @@
-addColumn('{{%pages}}', 'slug', $this->string()->after('title'));
- $this->execute('UPDATE pages SET slug=title');
- $this->alterColumn('{{%pages}}','slug',$this->string()->after('title')->notNull()->unique());
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%page}}', 'slug');
- }
-}
diff --git a/backend/migrations/m240502_232532_add_approval_column_to_player_table.php b/backend/migrations/m240502_232532_add_approval_column_to_player_table.php
deleted file mode 100644
index e1f74dcde..000000000
--- a/backend/migrations/m240502_232532_add_approval_column_to_player_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%player}}', 'approval', $this->integer()->defaultValue(0));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%player}}', 'approval');
- }
-}
diff --git a/backend/migrations/m240506_091812_create_player_metadata_table.php b/backend/migrations/m240506_091812_create_player_metadata_table.php
deleted file mode 100644
index c427fa511..000000000
--- a/backend/migrations/m240506_091812_create_player_metadata_table.php
+++ /dev/null
@@ -1,61 +0,0 @@
-createTable('{{%player_metadata}}', [
- 'player_id' => $this->primaryKey()->unsigned()->notNull(),
- 'identificationFile'=>$this->string(64),
- 'affiliation'=>$this->string(64),
- ]);
-
- // creates index for column `player_id`
- $this->createIndex(
- '{{%idx-player_metadata-player_id}}',
- '{{%player_metadata}}',
- 'player_id'
- );
-
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-player_metadata-player_id}}',
- '{{%player_metadata}}',
- 'player_id',
- '{{%player}}',
- 'id',
- 'CASCADE'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- // drops foreign key for table `{{%player}}`
- $this->dropForeignKey(
- '{{%fk-player_metadata-player_id}}',
- '{{%player_metadata}}'
- );
-
- // drops index for column `player_id`
- $this->dropIndex(
- '{{%idx-player_metadata-player_id}}',
- '{{%player_metadata}}'
- );
-
- $this->dropTable('{{%player_metadata}}');
- }
-}
diff --git a/backend/migrations/m240506_093953_drop_affiliation_column_from_player_table.php b/backend/migrations/m240506_093953_drop_affiliation_column_from_player_table.php
deleted file mode 100644
index 08bdec3dd..000000000
--- a/backend/migrations/m240506_093953_drop_affiliation_column_from_player_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-dropColumn('{{%player}}', 'affiliation');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->addColumn('{{%player}}', 'affiliation', $this->integer());
- }
-}
diff --git a/backend/migrations/m240507_121449_create_language_table.php b/backend/migrations/m240507_121449_create_language_table.php
deleted file mode 100644
index 3b1bdb355..000000000
--- a/backend/migrations/m240507_121449_create_language_table.php
+++ /dev/null
@@ -1,646 +0,0 @@
- 'Abkhazian'],
- ['ace' => 'Achinese'],
- ['ach' => 'Acoli'],
- ['ada' => 'Adangme'],
- ['ady' => 'Adyghe'],
- ['aa' => 'Afar'],
- ['afh' => 'Afrihili'],
- ['af' => 'Afrikaans'],
- ['agq' => 'Aghem'],
- ['ain' => 'Ainu'],
- ['ak' => 'Akan'],
- ['akk' => 'Akkadian'],
- ['bss' => 'Akoose'],
- ['akz' => 'Alabama'],
- ['sq' => 'Albanian'],
- ['ale' => 'Aleut'],
- ['arq' => 'Algerian Arabic'],
- ['en_US' => 'American English'],
- ['ase' => 'American Sign Language'],
- ['am' => 'Amharic'],
- ['egy' => 'Ancient Egyptian'],
- ['grc' => 'Ancient Greek'],
- ['anp' => 'Angika'],
- ['njo' => 'Ao Naga'],
- ['ar' => 'Arabic'],
- ['an' => 'Aragonese'],
- ['arc' => 'Aramaic'],
- ['aro' => 'Araona'],
- ['arp' => 'Arapaho'],
- ['arw' => 'Arawak'],
- ['hy' => 'Armenian'],
- ['rup' => 'Aromanian'],
- ['frp' => 'Arpitan'],
- ['as' => 'Assamese'],
- ['ast' => 'Asturian'],
- ['asa' => 'Asu'],
- ['cch' => 'Atsam'],
- ['en_AU' => 'Australian English'],
- ['de_AT' => 'Austrian German'],
- ['av' => 'Avaric'],
- ['ae' => 'Avestan'],
- ['awa' => 'Awadhi'],
- ['ay' => 'Aymara'],
- ['az' => 'Azerbaijani'],
- ['bfq' => 'Badaga'],
- ['ksf' => 'Bafia'],
- ['bfd' => 'Bafut'],
- ['bqi' => 'Bakhtiari'],
- ['ban' => 'Balinese'],
- ['bal' => 'Baluchi'],
- ['bm' => 'Bambara'],
- ['bax' => 'Bamun'],
- ['bjn' => 'Banjar'],
- ['bas' => 'Basaa'],
- ['ba' => 'Bashkir'],
- ['eu' => 'Basque'],
- ['bbc' => 'Batak Toba'],
- ['bar' => 'Bavarian'],
- ['bej' => 'Beja'],
- ['be' => 'Belarusian'],
- ['bem' => 'Bemba'],
- ['bez' => 'Bena'],
- ['bn' => 'Bengali'],
- ['bew' => 'Betawi'],
- ['bho' => 'Bhojpuri'],
- ['bik' => 'Bikol'],
- ['bin' => 'Bini'],
- ['bpy' => 'Bishnupriya'],
- ['bi' => 'Bislama'],
- ['byn' => 'Blin'],
- ['zbl' => 'Blissymbols'],
- ['brx' => 'Bodo'],
- ['bs' => 'Bosnian'],
- ['brh' => 'Brahui'],
- ['bra' => 'Braj'],
- ['pt_BR' => 'Brazilian Portuguese'],
- ['br' => 'Breton'],
- ['en_GB' => 'British English'],
- ['bug' => 'Buginese'],
- ['bg' => 'Bulgarian'],
- ['bum' => 'Bulu'],
- ['bua' => 'Buriat'],
- ['my' => 'Burmese'],
- ['cad' => 'Caddo'],
- ['frc' => 'Cajun French'],
- ['en_CA' => 'Canadian English'],
- ['fr_CA' => 'Canadian French'],
- ['yue' => 'Cantonese'],
- ['cps' => 'Capiznon'],
- ['car' => 'Carib'],
- ['ca' => 'Catalan'],
- ['cay' => 'Cayuga'],
- ['ceb' => 'Cebuano'],
- ['tzm' => 'Central Atlas Tamazight'],
- ['dtp' => 'Central Dusun'],
- ['ckb' => 'Central Kurdish'],
- ['esu' => 'Central Yupik'],
- ['shu' => 'Chadian Arabic'],
- ['chg' => 'Chagatai'],
- ['ch' => 'Chamorro'],
- ['ce' => 'Chechen'],
- ['chr' => 'Cherokee'],
- ['chy' => 'Cheyenne'],
- ['chb' => 'Chibcha'],
- ['cgg' => 'Chiga'],
- ['qug' => 'Chimborazo Highland Quichua'],
- ['zh' => 'Chinese'],
- ['chn' => 'Chinook Jargon'],
- ['chp' => 'Chipewyan'],
- ['cho' => 'Choctaw'],
- ['cu' => 'Church Slavic'],
- ['chk' => 'Chuukese'],
- ['cv' => 'Chuvash'],
- ['nwc' => 'Classical Newari'],
- ['syc' => 'Classical Syriac'],
- ['ksh' => 'Colognian'],
- ['swb' => 'Comorian'],
- ['swc' => 'Congo Swahili'],
- ['cop' => 'Coptic'],
- ['kw' => 'Cornish'],
- ['co' => 'Corsican'],
- ['cr' => 'Cree'],
- ['mus' => 'Creek'],
- ['crh' => 'Crimean Turkish'],
- ['hr' => 'Croatian'],
- ['cs' => 'Czech'],
- ['dak' => 'Dakota'],
- ['da' => 'Danish'],
- ['dar' => 'Dargwa'],
- ['dzg' => 'Dazaga'],
- ['del' => 'Delaware'],
- ['din' => 'Dinka'],
- ['dv' => 'Divehi'],
- ['doi' => 'Dogri'],
- ['dgr' => 'Dogrib'],
- ['dua' => 'Duala'],
- ['nl' => 'Dutch'],
- ['dyu' => 'Dyula'],
- ['dz' => 'Dzongkha'],
- ['frs' => 'Eastern Frisian'],
- ['efi' => 'Efik'],
- ['arz' => 'Egyptian Arabic'],
- ['eka' => 'Ekajuk'],
- ['elx' => 'Elamite'],
- ['ebu' => 'Embu'],
- ['egl' => 'Emilian'],
- ['en' => 'English'],
- ['myv' => 'Erzya'],
- ['eo' => 'Esperanto'],
- ['et' => 'Estonian'],
- ['pt_PT' => 'European Portuguese'],
- ['es_ES' => 'European Spanish'],
- ['ee' => 'Ewe'],
- ['ewo' => 'Ewondo'],
- ['ext' => 'Extremaduran'],
- ['fan' => 'Fang'],
- ['fat' => 'Fanti'],
- ['fo' => 'Faroese'],
- ['hif' => 'Fiji Hindi'],
- ['fj' => 'Fijian'],
- ['fil' => 'Filipino'],
- ['fi' => 'Finnish'],
- ['nl_BE' => 'Flemish'],
- ['fon' => 'Fon'],
- ['gur' => 'Frafra'],
- ['fr' => 'French'],
- ['fur' => 'Friulian'],
- ['ff' => 'Fulah'],
- ['gaa' => 'Ga'],
- ['gag' => 'Gagauz'],
- ['gl' => 'Galician'],
- ['gan' => 'Gan Chinese'],
- ['lg' => 'Ganda'],
- ['gay' => 'Gayo'],
- ['gba' => 'Gbaya'],
- ['gez' => 'Geez'],
- ['ka' => 'Georgian'],
- ['de' => 'German'],
- ['aln' => 'Gheg Albanian'],
- ['bbj' => 'Ghomala'],
- ['glk' => 'Gilaki'],
- ['gil' => 'Gilbertese'],
- ['gom' => 'Goan Konkani'],
- ['gon' => 'Gondi'],
- ['gor' => 'Gorontalo'],
- ['got' => 'Gothic'],
- ['grb' => 'Grebo'],
- ['el' => 'Greek'],
- ['gn' => 'Guarani'],
- ['gu' => 'Gujarati'],
- ['guz' => 'Gusii'],
- ['gwi' => 'Gwichʼin'],
- ['hai' => 'Haida'],
- ['ht' => 'Haitian'],
- ['hak' => 'Hakka Chinese'],
- ['ha' => 'Hausa'],
- ['haw' => 'Hawaiian'],
- ['he' => 'Hebrew'],
- ['hz' => 'Herero'],
- ['hil' => 'Hiligaynon'],
- ['hi' => 'Hindi'],
- ['ho' => 'Hiri Motu'],
- ['hit' => 'Hittite'],
- ['hmn' => 'Hmong'],
- ['hu' => 'Hungarian'],
- ['hup' => 'Hupa'],
- ['iba' => 'Iban'],
- ['ibb' => 'Ibibio'],
- ['is' => 'Icelandic'],
- ['io' => 'Ido'],
- ['ig' => 'Igbo'],
- ['ilo' => 'Iloko'],
- ['smn' => 'Inari Sami'],
- ['id' => 'Indonesian'],
- ['izh' => 'Ingrian'],
- ['inh' => 'Ingush'],
- ['ia' => 'Interlingua'],
- ['ie' => 'Interlingue'],
- ['iu' => 'Inuktitut'],
- ['ik' => 'Inupiaq'],
- ['ga' => 'Irish'],
- ['it' => 'Italian'],
- ['jam' => 'Jamaican Creole English'],
- ['ja' => 'Japanese'],
- ['jv' => 'Javanese'],
- ['kaj' => 'Jju'],
- ['dyo' => 'Jola-Fonyi'],
- ['jrb' => 'Judeo-Arabic'],
- ['jpr' => 'Judeo-Persian'],
- ['jut' => 'Jutish'],
- ['kbd' => 'Kabardian'],
- ['kea' => 'Kabuverdianu'],
- ['kab' => 'Kabyle'],
- ['kac' => 'Kachin'],
- ['kgp' => 'Kaingang'],
- ['kkj' => 'Kako'],
- ['kl' => 'Kalaallisut'],
- ['kln' => 'Kalenjin'],
- ['xal' => 'Kalmyk'],
- ['kam' => 'Kamba'],
- ['kbl' => 'Kanembu'],
- ['kn' => 'Kannada'],
- ['kr' => 'Kanuri'],
- ['kaa' => 'Kara-Kalpak'],
- ['krc' => 'Karachay-Balkar'],
- ['krl' => 'Karelian'],
- ['ks' => 'Kashmiri'],
- ['csb' => 'Kashubian'],
- ['kaw' => 'Kawi'],
- ['kk' => 'Kazakh'],
- ['ken' => 'Kenyang'],
- ['kha' => 'Khasi'],
- ['km' => 'Khmer'],
- ['kho' => 'Khotanese'],
- ['khw' => 'Khowar'],
- ['ki' => 'Kikuyu'],
- ['kmb' => 'Kimbundu'],
- ['krj' => 'Kinaray-a'],
- ['rw' => 'Kinyarwanda'],
- ['kiu' => 'Kirmanjki'],
- ['tlh' => 'Klingon'],
- ['bkm' => 'Kom'],
- ['kv' => 'Komi'],
- ['koi' => 'Komi-Permyak'],
- ['kg' => 'Kongo'],
- ['kok' => 'Konkani'],
- ['ko' => 'Korean'],
- ['kfo' => 'Koro'],
- ['kos' => 'Kosraean'],
- ['avk' => 'Kotava'],
- ['khq' => 'Koyra Chiini'],
- ['ses' => 'Koyraboro Senni'],
- ['kpe' => 'Kpelle'],
- ['kri' => 'Krio'],
- ['kj' => 'Kuanyama'],
- ['kum' => 'Kumyk'],
- ['ku' => 'Kurdish'],
- ['kru' => 'Kurukh'],
- ['kut' => 'Kutenai'],
- ['nmg' => 'Kwasio'],
- ['ky' => 'Kyrgyz'],
- ['quc' => 'Kʼicheʼ'],
- ['lad' => 'Ladino'],
- ['lah' => 'Lahnda'],
- ['lkt' => 'Lakota'],
- ['lam' => 'Lamba'],
- ['lag' => 'Langi'],
- ['lo' => 'Lao'],
- ['ltg' => 'Latgalian'],
- ['la' => 'Latin'],
- ['es_419' => 'Latin American Spanish'],
- ['lv' => 'Latvian'],
- ['lzz' => 'Laz'],
- ['lez' => 'Lezghian'],
- ['lij' => 'Ligurian'],
- ['li' => 'Limburgish'],
- ['ln' => 'Lingala'],
- ['lfn' => 'Lingua Franca Nova'],
- ['lzh' => 'Literary Chinese'],
- ['lt' => 'Lithuanian'],
- ['liv' => 'Livonian'],
- ['jbo' => 'Lojban'],
- ['lmo' => 'Lombard'],
- ['nds' => 'Low German'],
- ['sli' => 'Lower Silesian'],
- ['dsb' => 'Lower Sorbian'],
- ['loz' => 'Lozi'],
- ['lu' => 'Luba-Katanga'],
- ['lua' => 'Luba-Lulua'],
- ['lui' => 'Luiseno'],
- ['smj' => 'Lule Sami'],
- ['lun' => 'Lunda'],
- ['luo' => 'Luo'],
- ['lb' => 'Luxembourgish'],
- ['luy' => 'Luyia'],
- ['mde' => 'Maba'],
- ['mk' => 'Macedonian'],
- ['jmc' => 'Machame'],
- ['mad' => 'Madurese'],
- ['maf' => 'Mafa'],
- ['mag' => 'Magahi'],
- ['vmf' => 'Main-Franconian'],
- ['mai' => 'Maithili'],
- ['mak' => 'Makasar'],
- ['mgh' => 'Makhuwa-Meetto'],
- ['kde' => 'Makonde'],
- ['mg' => 'Malagasy'],
- ['ms' => 'Malay'],
- ['ml' => 'Malayalam'],
- ['mt' => 'Maltese'],
- ['mnc' => 'Manchu'],
- ['mdr' => 'Mandar'],
- ['man' => 'Mandingo'],
- ['mni' => 'Manipuri'],
- ['gv' => 'Manx'],
- ['mi' => 'Maori'],
- ['arn' => 'Mapuche'],
- ['mr' => 'Marathi'],
- ['chm' => 'Mari'],
- ['mh' => 'Marshallese'],
- ['mwr' => 'Marwari'],
- ['mas' => 'Masai'],
- ['mzn' => 'Mazanderani'],
- ['byv' => 'Medumba'],
- ['men' => 'Mende'],
- ['mwv' => 'Mentawai'],
- ['mer' => 'Meru'],
- ['mgo' => 'Metaʼ'],
- ['es_MX' => 'Mexican Spanish'],
- ['mic' => 'Micmac'],
- ['dum' => 'Middle Dutch'],
- ['enm' => 'Middle English'],
- ['frm' => 'Middle French'],
- ['gmh' => 'Middle High German'],
- ['mga' => 'Middle Irish'],
- ['nan' => 'Min Nan Chinese'],
- ['min' => 'Minangkabau'],
- ['xmf' => 'Mingrelian'],
- ['mwl' => 'Mirandese'],
- ['lus' => 'Mizo'],
- ['ar_001' => 'Modern Standard Arabic'],
- ['moh' => 'Mohawk'],
- ['mdf' => 'Moksha'],
- ['ro_MD' => 'Moldavian'],
- ['lol' => 'Mongo'],
- ['mn' => 'Mongolian'],
- ['mfe' => 'Morisyen'],
- ['ary' => 'Moroccan Arabic'],
- ['mos' => 'Mossi'],
- ['mul' => 'Multiple Languages'],
- ['mua' => 'Mundang'],
- ['ttt' => 'Muslim Tat'],
- ['mye' => 'Myene'],
- ['naq' => 'Nama'],
- ['na' => 'Nauru'],
- ['nv' => 'Navajo'],
- ['ng' => 'Ndonga'],
- ['nap' => 'Neapolitan'],
- ['ne' => 'Nepali'],
- ['new' => 'Newari'],
- ['sba' => 'Ngambay'],
- ['nnh' => 'Ngiemboon'],
- ['jgo' => 'Ngomba'],
- ['yrl' => 'Nheengatu'],
- ['nia' => 'Nias'],
- ['niu' => 'Niuean'],
- ['zxx' => 'No linguistic content'],
- ['nog' => 'Nogai'],
- ['nd' => 'North Ndebele'],
- ['frr' => 'Northern Frisian'],
- ['se' => 'Northern Sami'],
- ['nso' => 'Northern Sotho'],
- ['no' => 'Norwegian'],
- ['nb' => 'Norwegian Bokmål'],
- ['nn' => 'Norwegian Nynorsk'],
- ['nov' => 'Novial'],
- ['nus' => 'Nuer'],
- ['nym' => 'Nyamwezi'],
- ['ny' => 'Nyanja'],
- ['nyn' => 'Nyankole'],
- ['tog' => 'Nyasa Tonga'],
- ['nyo' => 'Nyoro'],
- ['nzi' => 'Nzima'],
- ['nqo' => 'NʼKo'],
- ['oc' => 'Occitan'],
- ['oj' => 'Ojibwa'],
- ['ang' => 'Old English'],
- ['fro' => 'Old French'],
- ['goh' => 'Old High German'],
- ['sga' => 'Old Irish'],
- ['non' => 'Old Norse'],
- ['peo' => 'Old Persian'],
- ['pro' => 'Old Provençal'],
- ['or' => 'Oriya'],
- ['om' => 'Oromo'],
- ['osa' => 'Osage'],
- ['os' => 'Ossetic'],
- ['ota' => 'Ottoman Turkish'],
- ['pal' => 'Pahlavi'],
- ['pfl' => 'Palatine German'],
- ['pau' => 'Palauan'],
- ['pi' => 'Pali'],
- ['pam' => 'Pampanga'],
- ['pag' => 'Pangasinan'],
- ['pap' => 'Papiamento'],
- ['ps' => 'Pashto'],
- ['pdc' => 'Pennsylvania German'],
- ['fa' => 'Persian'],
- ['phn' => 'Phoenician'],
- ['pcd' => 'Picard'],
- ['pms' => 'Piedmontese'],
- ['pdt' => 'Plautdietsch'],
- ['pon' => 'Pohnpeian'],
- ['pl' => 'Polish'],
- ['pnt' => 'Pontic'],
- ['pt' => 'Portuguese'],
- ['prg' => 'Prussian'],
- ['pa' => 'Punjabi'],
- ['qu' => 'Quechua'],
- ['raj' => 'Rajasthani'],
- ['rap' => 'Rapanui'],
- ['rar' => 'Rarotongan'],
- ['rif' => 'Riffian'],
- ['rgn' => 'Romagnol'],
- ['ro' => 'Romanian'],
- ['rm' => 'Romansh'],
- ['rom' => 'Romany'],
- ['rof' => 'Rombo'],
- ['root' => 'Root'],
- ['rtm' => 'Rotuman'],
- ['rug' => 'Roviana'],
- ['rn' => 'Rundi'],
- ['ru' => 'Russian'],
- ['rue' => 'Rusyn'],
- ['rwk' => 'Rwa'],
- ['ssy' => 'Saho'],
- ['sah' => 'Sakha'],
- ['sam' => 'Samaritan Aramaic'],
- ['saq' => 'Samburu'],
- ['sm' => 'Samoan'],
- ['sgs' => 'Samogitian'],
- ['sad' => 'Sandawe'],
- ['sg' => 'Sango'],
- ['sbp' => 'Sangu'],
- ['sa' => 'Sanskrit'],
- ['sat' => 'Santali'],
- ['sc' => 'Sardinian'],
- ['sas' => 'Sasak'],
- ['sdc' => 'Sassarese Sardinian'],
- ['stq' => 'Saterland Frisian'],
- ['saz' => 'Saurashtra'],
- ['sco' => 'Scots'],
- ['gd' => 'Scottish Gaelic'],
- ['sly' => 'Selayar'],
- ['sel' => 'Selkup'],
- ['seh' => 'Sena'],
- ['see' => 'Seneca'],
- ['sr' => 'Serbian'],
- ['sh' => 'Serbo-Croatian'],
- ['srr' => 'Serer'],
- ['sei' => 'Seri'],
- ['ksb' => 'Shambala'],
- ['shn' => 'Shan'],
- ['sn' => 'Shona'],
- ['ii' => 'Sichuan Yi'],
- ['scn' => 'Sicilian'],
- ['sid' => 'Sidamo'],
- ['bla' => 'Siksika'],
- ['szl' => 'Silesian'],
- ['zh_Hans' => 'Simplified Chinese'],
- ['sd' => 'Sindhi'],
- ['si' => 'Sinhala'],
- ['sms' => 'Skolt Sami'],
- ['den' => 'Slave'],
- ['sk' => 'Slovak'],
- ['sl' => 'Slovenian'],
- ['xog' => 'Soga'],
- ['sog' => 'Sogdien'],
- ['so' => 'Somali'],
- ['snk' => 'Soninke'],
- ['azb' => 'South Azerbaijani'],
- ['nr' => 'South Ndebele'],
- ['alt' => 'Southern Altai'],
- ['sma' => 'Southern Sami'],
- ['st' => 'Southern Sotho'],
- ['es' => 'Spanish'],
- ['srn' => 'Sranan Tongo'],
- ['zgh' => 'Standard Moroccan Tamazight'],
- ['suk' => 'Sukuma'],
- ['sux' => 'Sumerian'],
- ['su' => 'Sundanese'],
- ['sus' => 'Susu'],
- ['sw' => 'Swahili'],
- ['ss' => 'Swati'],
- ['sv' => 'Swedish'],
- ['fr_CH' => 'Swiss French'],
- ['gsw' => 'Swiss German'],
- ['de_CH' => 'Swiss High German'],
- ['syr' => 'Syriac'],
- ['shi' => 'Tachelhit'],
- ['tl' => 'Tagalog'],
- ['ty' => 'Tahitian'],
- ['dav' => 'Taita'],
- ['tg' => 'Tajik'],
- ['tly' => 'Talysh'],
- ['tmh' => 'Tamashek'],
- ['ta' => 'Tamil'],
- ['trv' => 'Taroko'],
- ['twq' => 'Tasawaq'],
- ['tt' => 'Tatar'],
- ['te' => 'Telugu'],
- ['ter' => 'Tereno'],
- ['teo' => 'Teso'],
- ['tet' => 'Tetum'],
- ['th' => 'Thai'],
- ['bo' => 'Tibetan'],
- ['tig' => 'Tigre'],
- ['ti' => 'Tigrinya'],
- ['tem' => 'Timne'],
- ['tiv' => 'Tiv'],
- ['tli' => 'Tlingit'],
- ['tpi' => 'Tok Pisin'],
- ['tkl' => 'Tokelau'],
- ['to' => 'Tongan'],
- ['fit' => 'Tornedalen Finnish'],
- ['zh_Hant' => 'Traditional Chinese'],
- ['tkr' => 'Tsakhur'],
- ['tsd' => 'Tsakonian'],
- ['tsi' => 'Tsimshian'],
- ['ts' => 'Tsonga'],
- ['tn' => 'Tswana'],
- ['tcy' => 'Tulu'],
- ['tum' => 'Tumbuka'],
- ['aeb' => 'Tunisian Arabic'],
- ['tr' => 'Turkish'],
- ['tk' => 'Turkmen'],
- ['tru' => 'Turoyo'],
- ['tvl' => 'Tuvalu'],
- ['tyv' => 'Tuvinian'],
- ['tw' => 'Twi'],
- ['kcg' => 'Tyap'],
- ['udm' => 'Udmurt'],
- ['uga' => 'Ugaritic'],
- ['uk' => 'Ukrainian'],
- ['umb' => 'Umbundu'],
- ['und' => 'Unknown Language'],
- ['hsb' => 'Upper Sorbian'],
- ['ur' => 'Urdu'],
- ['ug' => 'Uyghur'],
- ['uz' => 'Uzbek'],
- ['vai' => 'Vai'],
- ['ve' => 'Venda'],
- ['vec' => 'Venetian'],
- ['vep' => 'Veps'],
- ['vi' => 'Vietnamese'],
- ['vo' => 'Volapük'],
- ['vro' => 'Võro'],
- ['vot' => 'Votic'],
- ['vun' => 'Vunjo'],
- ['wa' => 'Walloon'],
- ['wae' => 'Walser'],
- ['war' => 'Waray'],
- ['wbp' => 'Warlpiri'],
- ['was' => 'Washo'],
- ['guc' => 'Wayuu'],
- ['cy' => 'Welsh'],
- ['vls' => 'West Flemish'],
- ['fy' => 'Western Frisian'],
- ['mrj' => 'Western Mari'],
- ['wal' => 'Wolaytta'],
- ['wo' => 'Wolof'],
- ['wuu' => 'Wu Chinese'],
- ['xh' => 'Xhosa'],
- ['hsn' => 'Xiang Chinese'],
- ['yav' => 'Yangben'],
- ['yao' => 'Yao'],
- ['yap' => 'Yapese'],
- ['ybb' => 'Yemba'],
- ['yi' => 'Yiddish'],
- ['yo' => 'Yoruba'],
- ['zap' => 'Zapotec'],
- ['dje' => 'Zarma'],
- ['zza' => 'Zaza'],
- ['zea' => 'Zeelandic'],
- ['zen' => 'Zenaga'],
- ['za' => 'Zhuang'],
- ['gbz' => 'Zoroastrian Dari'],
- ['zu' => 'Zulu'],
- ['zun' => 'Zuni'],
- ];
-
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $this->createTable('{{%language}}', [
- 'id' => $this->string(8)->notNull(),
- 'l' => $this->string(36),
- 'PRIMARY KEY (id)'
- ]);
-
- foreach($this->languages as $entry)
- {
- $this->upsert('language',['id'=>key($entry),'l'=>current($entry)]);
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%language}}');
- }
-}
diff --git a/backend/migrations/m240507_121450_add_language_column_to_writeup_table.php b/backend/migrations/m240507_121450_add_language_column_to_writeup_table.php
deleted file mode 100644
index 5c6dcd0a7..000000000
--- a/backend/migrations/m240507_121450_add_language_column_to_writeup_table.php
+++ /dev/null
@@ -1,27 +0,0 @@
-addColumn('{{%writeup}}', 'language_id', $this->string(8)->after('formatter')->notNull()->defaultValue('en'));
- $this->addForeignKey('fk_language_id', 'writeup', 'language_id', 'language', 'id');
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%writeup}}', 'language');
- }
-}
diff --git a/backend/migrations/m240507_234037_add_locked_column_to_team_table.php b/backend/migrations/m240507_234037_add_locked_column_to_team_table.php
deleted file mode 100644
index 7d20a2559..000000000
--- a/backend/migrations/m240507_234037_add_locked_column_to_team_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-addColumn('{{%team}}', 'locked', $this->boolean()->notNull()->defaultValue(0));
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropColumn('{{%team}}', 'locked');
- }
-}
diff --git a/backend/migrations/m240918_062559_add_email_unique_index.php b/backend/migrations/m240918_062559_add_email_unique_index.php
deleted file mode 100644
index 6bbe9b678..000000000
--- a/backend/migrations/m240918_062559_add_email_unique_index.php
+++ /dev/null
@@ -1,26 +0,0 @@
-db->createCommand('alter table player drop index if exists player_email_idx')->execute();
- $this->createIndex ( 'player_email_idx', 'player', 'email', true);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropIndex ( 'player_email_idx', 'player');
- }
-}
diff --git a/backend/migrations/m241016_190515_update_tai_writeup_trigger.php b/backend/migrations/m241016_190515_update_tai_writeup_trigger.php
deleted file mode 100644
index 70ceca030..000000000
--- a/backend/migrations/m241016_190515_update_tai_writeup_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-0,1,0) WHERE id=NEW.target_id;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m241027_110007_update_calculate_ranks_procedure_to_make_dynamic.php b/backend/migrations/m241027_110007_update_calculate_ranks_procedure_to_make_dynamic.php
deleted file mode 100644
index 9d44762e1..000000000
--- a/backend/migrations/m241027_110007_update_calculate_ranks_procedure_to_make_dynamic.php
+++ /dev/null
@@ -1,52 +0,0 @@
-= v_max
- END REPEAT;
- END IF;
- END";
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m241027_110150_update_calculate_team_ranks_procedure_to_make_dynamic.php b/backend/migrations/m241027_110150_update_calculate_team_ranks_procedure_to_make_dynamic.php
deleted file mode 100644
index 72af0d706..000000000
--- a/backend/migrations/m241027_110150_update_calculate_team_ranks_procedure_to_make_dynamic.php
+++ /dev/null
@@ -1,56 +0,0 @@
-0 AND (SELECT val FROM sysconfig WHERE id='teams')=1 THEN
- REPEAT
- CREATE TEMPORARY TABLE `tr_ranking` (id int primary key AUTO_INCREMENT,team_id int) ENGINE=MEMORY CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- START TRANSACTION;
- -- DELETE team of a given academic category or no longer exist in the table
- delete from team_rank where team_id in (select id from team where academic=v_counter) OR team_id NOT IN (select id from team);
- insert into tr_ranking select NULL,t.team_id from team_score as t left join team as t2 on t.team_id=t2.id WHERE t2.academic=v_counter order by points desc,t.ts asc, t.team_id asc;
- insert IGNORE into team_rank select * from tr_ranking;
- COMMIT;
- DROP TABLE `tr_ranking`;
- SET v_counter=v_counter+1;
- UNTIL v_counter >= v_max
- END REPEAT;
- END IF;
- END IF;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m241030_064325_create_archived_stream_table.php b/backend/migrations/m241030_064325_create_archived_stream_table.php
deleted file mode 100644
index d144f0b60..000000000
--- a/backend/migrations/m241030_064325_create_archived_stream_table.php
+++ /dev/null
@@ -1,25 +0,0 @@
-db->createCommand("CREATE TABLE IF NOT EXISTS archived_stream AS SELECT * FROM stream WHERE id is null")->execute();
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%archived_stream}}');
- }
-}
diff --git a/backend/migrations/m241030_064326_update_tau_player_add_deleted_status.php b/backend/migrations/m241030_064326_update_tau_player_add_deleted_status.php
deleted file mode 100644
index 7580235ba..000000000
--- a/backend/migrations/m241030_064326_update_tau_player_add_deleted_status.php
+++ /dev/null
@@ -1,47 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m241030_083703_update_tau_player_score_non_negative_points.php b/backend/migrations/m241030_083703_update_tau_player_score_non_negative_points.php
deleted file mode 100644
index aee863aaa..000000000
--- a/backend/migrations/m241030_083703_update_tau_player_score_non_negative_points.php
+++ /dev/null
@@ -1,32 +0,0 @@
-=OLD.points THEN
- INSERT INTO player_score_monthly (player_id, points, dated_at) VALUES (NEW.player_id, ABS(ifnull(OLD.points,0)-NEW.points), EXTRACT(YEAR_MONTH FROM NOW())) ON DUPLICATE KEY UPDATE points=points+values(points);
- END IF;
- END";
-
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m241101_080235_create_team_invite_table.php b/backend/migrations/m241101_080235_create_team_invite_table.php
deleted file mode 100644
index ecbf586f4..000000000
--- a/backend/migrations/m241101_080235_create_team_invite_table.php
+++ /dev/null
@@ -1,33 +0,0 @@
-createTable('{{%team_invite}}', [
- 'id' => $this->primaryKey(),
- 'team_id' => $this->integer(),
- 'token' => $this->string(32)->notNull()->unique()->defaultValue(''),
- 'created_at' => $this->dateTime(),
- 'updated_at' => $this->timestamp(),
- ]);
- $this->addForeignKey('fk_team_id', 'team_invite', 'team_id', 'team', 'id', 'CASCADE', 'CASCADE');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropForeignKey('fk_team_id', 'team_invite');
- $this->dropTable('{{%team_invite}}');
- }
-}
diff --git a/backend/migrations/m241101_102909_populate_invite_urls.php b/backend/migrations/m241101_102909_populate_invite_urls.php
deleted file mode 100644
index fa3068528..000000000
--- a/backend/migrations/m241101_102909_populate_invite_urls.php
+++ /dev/null
@@ -1,30 +0,0 @@
-db->createCommand("SELECT id FROM team")->queryAll();
- foreach($res as $rec)
- {
- $now=new \yii\db\Expression('NOW()');
- $this->upsert('team_invite',['team_id'=>$rec['id'],'token'=>\Yii::$app->security->generateRandomString(8),'created_at'=>$now]);
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "m241101_102909_populate_invite_urls cannot be reverted.\n";
- }
-}
diff --git a/backend/migrations/m241102_094821_create_player_disconnect_queue_table.php b/backend/migrations/m241102_094821_create_player_disconnect_queue_table.php
deleted file mode 100644
index cb70846f5..000000000
--- a/backend/migrations/m241102_094821_create_player_disconnect_queue_table.php
+++ /dev/null
@@ -1,31 +0,0 @@
-createTable('{{%player_disconnect_queue}}', [
- 'player_id' => 'int(10) unsigned NOT NULL',
- 'created_at' => $this->timestamp(),
- ]);
- $this->addPrimaryKey('pk_on_player_id', '{{%player_disconnect_queue}}', 'player_id');
- $this->addForeignKey('fk-player_id-player', '{{%player_disconnect_queue}}', 'player_id', 'player', 'id', 'CASCADE','CASCADE');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropForeignKey('fk-player_id-player', '{{%player_disconnect_queue}}');
- $this->dropTable('{{%player_disconnect_queue}}');
- }
-}
diff --git a/backend/migrations/m241102_113836_create_player_disconnect_queue_history_table.php b/backend/migrations/m241102_113836_create_player_disconnect_queue_history_table.php
deleted file mode 100644
index b8fd22c8b..000000000
--- a/backend/migrations/m241102_113836_create_player_disconnect_queue_history_table.php
+++ /dev/null
@@ -1,29 +0,0 @@
-createTable('{{%player_disconnect_queue_history}}', [
- 'id' => $this->primaryKey(),
- 'player_id' => $this->integer()->notNull(),
- 'created_at' => $this->timestamp(),
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%player_disconnect_queue_history}}');
- }
-}
diff --git a/backend/migrations/m241102_114127_create_tai_player_disconnect_queue_trigger.php b/backend/migrations/m241102_114127_create_tai_player_disconnect_queue_trigger.php
deleted file mode 100644
index 321186192..000000000
--- a/backend/migrations/m241102_114127_create_tai_player_disconnect_queue_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m241102_114132_create_tad_player_disconnect_queue_trigger.php b/backend/migrations/m241102_114132_create_tad_player_disconnect_queue_trigger.php
deleted file mode 100644
index a86530eeb..000000000
--- a/backend/migrations/m241102_114132_create_tad_player_disconnect_queue_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m241103_000427_create_player_token_table.php b/backend/migrations/m241103_000427_create_player_token_table.php
deleted file mode 100644
index 9b3428b86..000000000
--- a/backend/migrations/m241103_000427_create_player_token_table.php
+++ /dev/null
@@ -1,34 +0,0 @@
-createTable('{{%player_token}}', [
- 'player_id' => $this->integer()->unsigned()->notNull(),
- 'type' => $this->string(32)->notNull()->defaultValue('API'),
- 'token' => $this->string(128)->notNull()->unique(),
- 'description' => $this->text()->notNull()->defaultValue(""),
- 'expires_at' => $this->dateTime(),
- 'created_at' => $this->timestamp(),
- ]);
- $this->addPrimaryKey('player_token-pk', 'player_token', ['player_id', 'type']);
- $this->addForeignKey('fk-player_token-player_id-player', '{{%player_token}}', 'player_id', 'player', 'id', 'CASCADE', 'CASCADE');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%player_token}}');
- }
-}
diff --git a/backend/migrations/m241103_105725_create_player_token_history_table.php b/backend/migrations/m241103_105725_create_player_token_history_table.php
deleted file mode 100644
index 54bed7c0c..000000000
--- a/backend/migrations/m241103_105725_create_player_token_history_table.php
+++ /dev/null
@@ -1,35 +0,0 @@
-createTable('{{%player_token_history}}', [
- 'id'=>$this->primaryKey(),
- 'player_id' => $this->integer()->unsigned()->notNull(),
- 'type' => $this->string(32)->notNull()->defaultValue('API'),
- 'token' => $this->string(128)->notNull(),
- 'description' => $this->text()->notNull()->defaultValue(''),
- 'expires_at' => $this->dateTime(),
- 'created_at' => $this->timestamp(),
- 'ts' => $this->timestamp(),
- ]);
- $this->addForeignKey('fk-player_token_history-player_id-player', '{{%player_token_history}}', 'player_id', 'player', 'id', 'CASCADE', 'CASCADE');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%player_token}}');
- }
-}
diff --git a/backend/migrations/m241103_105924_create_tai_player_token_trigger.php b/backend/migrations/m241103_105924_create_tai_player_token_trigger.php
deleted file mode 100644
index baee66820..000000000
--- a/backend/migrations/m241103_105924_create_tai_player_token_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m241103_105954_create_tau_player_token_trigger.php b/backend/migrations/m241103_105954_create_tau_player_token_trigger.php
deleted file mode 100644
index a26596dbb..000000000
--- a/backend/migrations/m241103_105954_create_tau_player_token_trigger.php
+++ /dev/null
@@ -1,31 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m241103_110652_create_tad_player_token_trigger.php b/backend/migrations/m241103_110652_create_tad_player_token_trigger.php
deleted file mode 100644
index bb599fc34..000000000
--- a/backend/migrations/m241103_110652_create_tad_player_token_trigger.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m241103_121625_create_expire_player_tokens_procedure.php b/backend/migrations/m241103_121625_create_expire_player_tokens_procedure.php
deleted file mode 100644
index 069680da0..000000000
--- a/backend/migrations/m241103_121625_create_expire_player_tokens_procedure.php
+++ /dev/null
@@ -1,36 +0,0 @@
-0 THEN
- START TRANSACTION;
- INSERT INTO notification (player_id,category,title,body,archived,created_at,updated_at) SELECT player_id,'info','Token expiration',CONCAT(type,' Token [',description,'] expired at ',expires_at),0,tnow,tnow FROM player_token WHERE expires_at0 THEN
- DELETE FROM player_token WHERE expires_atdb->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m241103_121633_create_ev_player_token_expiration_event.php b/backend/migrations/m241103_121633_create_ev_player_token_expiration_event.php
deleted file mode 100644
index 69788c501..000000000
--- a/backend/migrations/m241103_121633_create_ev_player_token_expiration_event.php
+++ /dev/null
@@ -1,28 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m241104_201004_drop_token_columns_from_player_table.php b/backend/migrations/m241104_201004_drop_token_columns_from_player_table.php
deleted file mode 100644
index bca79d34d..000000000
--- a/backend/migrations/m241104_201004_drop_token_columns_from_player_table.php
+++ /dev/null
@@ -1,29 +0,0 @@
-db->createCommand("INSERT INTO player_token (player_id,type,token,expires_at,created_at) SELECT id,'password_reset',substr(password_reset_token,1,30),now()+ INTERVAL 24 HOUR,now() FROM player WHERE password_reset_token is not null and password_reset_token!=''")->execute();
- $this->db->createCommand("INSERT INTO player_token (player_id,type,token,expires_at,created_at) SELECT id,'email_verification',substr(verification_token,1,30),now()+ INTERVAL 24 HOUR,now() FROM player WHERE verification_token is not null and verification_token!=''")->execute();
- $this->dropColumn('player', 'password_reset_token');
- $this->dropColumn('player', 'verification_token');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->addColumn('player', 'password_reset_token', $this->string());
- $this->addColumn('player', 'verification_token', $this->string());
- }
-}
diff --git a/backend/migrations/m241104_231037_drop_tbu_player_trigger.php b/backend/migrations/m241104_231037_drop_tbu_player_trigger.php
deleted file mode 100644
index 19a46f5d8..000000000
--- a/backend/migrations/m241104_231037_drop_tbu_player_trigger.php
+++ /dev/null
@@ -1,21 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- }
-
- public function down()
- {
- echo "Nothing to reverse...";
- }
-}
diff --git a/backend/migrations/m241105_014128_create_speed_problem_table.php b/backend/migrations/m241105_014128_create_speed_problem_table.php
deleted file mode 100644
index 9ca380e7f..000000000
--- a/backend/migrations/m241105_014128_create_speed_problem_table.php
+++ /dev/null
@@ -1,37 +0,0 @@
-createTable('{{%speed_problem}}', [
- 'id' => $this->primaryKey(),
- 'name' => $this->string(),
- 'description' => $this->text(),
- 'active' => $this->boolean()->notNull()->defaultValue(1),
- 'difficulty' => $this->smallInteger()->notNull()->defaultValue(0),
- 'category' => $this->string(64),
- 'server' => $this->string(),
- 'challenge_image' => $this->string(),
- 'validator_image' => $this->string(),
- 'created_at' => $this->datetime(),
- 'updated_at' => $this->datetime(),
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('{{%speed_problem}}');
- }
-}
diff --git a/backend/migrations/m241105_014129_create_speed_solution_table.php b/backend/migrations/m241105_014129_create_speed_solution_table.php
deleted file mode 100644
index d07bbf238..000000000
--- a/backend/migrations/m241105_014129_create_speed_solution_table.php
+++ /dev/null
@@ -1,106 +0,0 @@
-createTable('{{%speed_solution}}', [
- 'id' => $this->primaryKey(),
- 'player_id' => $this->integer()->unsigned()->notNull(),
- 'problem_id' => $this->integer()->notNull(),
- 'language' => $this->string(),
- 'sourcecode' => 'LONGBLOB',
- 'status' => $this->string(),
- 'points' => $this->integer()->defaultValue(0),
- 'created_at' => $this->datetime(),
- 'updated_at' => $this->datetime(),
- ]);
-
- // creates index for column `player_id`
- $this->createIndex(
- '{{%idx-speed_solution-player_id}}',
- '{{%speed_solution}}',
- 'player_id'
- );
-
- // add foreign key for table `{{%player}}`
- $this->addForeignKey(
- '{{%fk-speed_solution-player_id}}',
- '{{%speed_solution}}',
- 'player_id',
- '{{%player}}',
- 'id',
- 'CASCADE'
- );
-
- // creates index for column `problem_id`
- $this->createIndex(
- '{{%idx-speed_solution-problem_id}}',
- '{{%speed_solution}}',
- 'problem_id'
- );
-
- // add foreign key for table `{{%speed_problem}}`
- $this->addForeignKey(
- '{{%fk-speed_solution-problem_id}}',
- '{{%speed_solution}}',
- 'problem_id',
- '{{%speed_problem}}',
- 'id',
- 'CASCADE'
- );
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- // drops foreign key for table `{{%player}}`
- $this->dropForeignKey(
- '{{%fk-speed_solution-player_id}}',
- '{{%speed_solution}}'
- );
-
- // drops index for column `player_id`
- $this->dropIndex(
- '{{%idx-speed_solution-player_id}}',
- '{{%speed_solution}}'
- );
-
- // drops foreign key for table `{{%team}}`
- $this->dropForeignKey(
- '{{%fk-speed_solution-team_id}}',
- '{{%speed_solution}}'
- );
-
- // drops index for column `team_id`
- $this->dropIndex(
- '{{%idx-speed_solution-team_id}}',
- '{{%speed_solution}}'
- );
-
- // drops foreign key for table `{{%target}}`
- $this->dropForeignKey(
- '{{%fk-speed_solution-target_id}}',
- '{{%speed_solution}}'
- );
-
- // drops index for column `target_id`
- $this->dropIndex(
- '{{%idx-speed_solution-target_id}}',
- '{{%speed_solution}}'
- );
-
- $this->dropTable('{{%speed_solution}}');
- }
-}
diff --git a/backend/migrations/m241106_082202_create_player_maintenance_procedure.php b/backend/migrations/m241106_082202_create_player_maintenance_procedure.php
deleted file mode 100644
index c394ee4f0..000000000
--- a/backend/migrations/m241106_082202_create_player_maintenance_procedure.php
+++ /dev/null
@@ -1,48 +0,0 @@
-0 AND player_delete_rejected_after IS NOT NULL AND player_delete_rejected_after>0 THEN
- DELETE FROM `player` WHERE `ts` < NOW() - INTERVAL player_delete_rejected_after DAY AND `status`=9 AND approval=4;
- END IF;
-
- IF player_delete_inactive_after IS NOT NULL AND player_delete_inactive_after > 0 THEN
- DELETE FROM `player` WHERE `ts` < NOW() - INTERVAL player_delete_inactive_after DAY AND `status`=9;
- END IF;
-
- IF player_delete_deleted_after IS NOT NULL AND player_delete_deleted_after > 0 THEN
- DELETE FROM `player` WHERE `ts` < NOW() - INTERVAL player_delete_deleted_after DAY AND `status`=0;
- END IF;
-
- IF player_changed_to_deleted_after IS NOT NULL AND player_changed_to_deleted_after > 0 THEN
- UPDATE player SET status=0 WHERE status=8 AND ts < NOW() - INTERVAL player_changed_to_deleted_after DAY;
- END IF;
- END";
-
-// Use up()/down() to run migration code without a transaction.
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m241106_082203_update_player_maintenance_event.php b/backend/migrations/m241106_082203_update_player_maintenance_event.php
deleted file mode 100644
index 41d4f802e..000000000
--- a/backend/migrations/m241106_082203_update_player_maintenance_event.php
+++ /dev/null
@@ -1,26 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/migrations/m241110_214630_from_v0_25_0_to_v1_0_0.php b/backend/migrations/m241110_214630_from_v0_25_0_to_v1_0_0.php
new file mode 100644
index 000000000..4a5c463f8
--- /dev/null
+++ b/backend/migrations/m241110_214630_from_v0_25_0_to_v1_0_0.php
@@ -0,0 +1,31 @@
+db->createCommand("SELECT COUNT(*) FROM init_data")->queryScalar();
+ if($is_existing>0){
+ $this->upsert('init_data',['version'=>'m241108_100648_populate_default_sysconfig_keys','apply_time'=>time()]);
+ // add missing url routes
+ }
+ $this->upsert('sysconfig',['id'=>'platform_version','val'=>'v1.0.0']);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ echo "Reversing version only!";
+ $this->upsert('sysconfig',['id'=>'platform_version','val'=>'v0.25.0']);
+ }
+}
diff --git a/backend/modules/frontend/views/player/ovpn.php b/backend/modules/frontend/views/player/ovpn.php
index c9e5d7197..b0d049deb 100644
--- a/backend/modules/frontend/views/player/ovpn.php
+++ b/backend/modules/frontend/views/player/ovpn.php
@@ -3,16 +3,16 @@
proto udp
dev tun
comp-lzo
-verb 3
+verb 1
mssfix 1400
cipher AES-256-CBC
+data-ciphers AES-256-CBC
auth SHA256
auth-nocache
remote-cert-tls server
remote sys->vpngw;?> 1194 udp
-remote sys->vpngw;?> 443 tcp
privkey;?>
@@ -26,4 +26,4 @@
key-direction 1
sys->{'vpn-ta.key'}; ?>
-
+
\ No newline at end of file
diff --git a/backend/modules/sales/migrations/m210206_125913_create_product_table.php b/backend/modules/sales/migrations/m210206_125913_create_product_table.php
index 134a50f85..dd6791bda 100644
--- a/backend/modules/sales/migrations/m210206_125913_create_product_table.php
+++ b/backend/modules/sales/migrations/m210206_125913_create_product_table.php
@@ -22,11 +22,6 @@ public function safeUp()
'metadata'=>$this->text(),
'htmlOptions'=>$this->text(),
'perks'=>$this->text(),
- 'price_id' => $this->string(40)->notNull(),
- 'currency' => $this->string(40)->notNull(),
- 'unit_amount'=>$this->bigInteger()->notNull()->defaultValue(0),
- 'interval'=>$this->string(20)->notNull()->defaultValue('day'),
- 'interval_count'=>$this->bigInteger()->notNull()->defaultValue(1),
'weight'=>$this->integer()->notNull()->defaultValue(0),
'created_at'=> $this->datetime(),
'updated_at'=> $this->datetime(),
diff --git a/backend/modules/sales/migrations/m210208_231414_create_headhunter_transfer_event.php b/backend/modules/sales/migrations/m210208_231414_create_headhunter_transfer_event.php
deleted file mode 100644
index 3e44aa0fd..000000000
--- a/backend/modules/sales/migrations/m210208_231414_create_headhunter_transfer_event.php
+++ /dev/null
@@ -1,28 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/backend/modules/sales/migrations/m210208_232789_create_do_subscription_expiration_procedure.php b/backend/modules/sales/migrations/m210208_232789_create_do_subscription_expiration_procedure.php
index ac9fab7be..b2324fbc8 100644
--- a/backend/modules/sales/migrations/m210208_232789_create_do_subscription_expiration_procedure.php
+++ b/backend/modules/sales/migrations/m210208_232789_create_do_subscription_expiration_procedure.php
@@ -16,8 +16,8 @@
*/
class m210208_232789_create_do_subscription_expiration_procedure extends Migration
{
- public $DROP_SQL="DROP PROCEDURE IF EXISTS {{%do_subscription_expiration}}";
- public $CREATE_SQL="CREATE PROCEDURE {{%do_subscription_expiration}} ()
+ public $DROP_SQL = "DROP PROCEDURE IF EXISTS {{%do_subscription_expiration}}";
+ public $CREATE_SQL = "CREATE PROCEDURE {{%do_subscription_expiration}} ()
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE csubscription_id varchar(255);
@@ -32,7 +32,7 @@ class m210208_232789_create_do_subscription_expiration_procedure extends Migrati
IF done THEN
LEAVE read_loop;
END IF;
- SELECT id INTO cproduct_id FROM product WHERE price_id=cprice_id;
+ SELECT product_id INTO cproduct_id FROM price WHERE id=cprice_id;
START TRANSACTION;
DELETE FROM network_player WHERE player_id=cplayer_id AND network_id IN (SELECT network_id FROM product_network WHERE product_id=cproduct_id);
UPDATE player_subscription SET active=0 WHERE player_id=cplayer_id AND subscription_id=csubscription_id AND price_id=cprice_id;
@@ -40,15 +40,15 @@ class m210208_232789_create_do_subscription_expiration_procedure extends Migrati
END LOOP;
CLOSE expiredCursor;
END";
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
+ public function up()
+ {
+ $this->db->createCommand($this->DROP_SQL)->execute();
+ $this->db->createCommand($this->CREATE_SQL)->execute();
+ }
+
+ public function down()
+ {
+ $this->db->createCommand($this->DROP_SQL)->execute();
+ }
}
diff --git a/backend/modules/sales/migrations/m210210_131842_add_subscription_badges.php b/backend/modules/sales/migrations/m210210_131842_add_subscription_badges.php
deleted file mode 100644
index d85d94b52..000000000
--- a/backend/modules/sales/migrations/m210210_131842_add_subscription_badges.php
+++ /dev/null
@@ -1,32 +0,0 @@
-insert('badge',[
- 'id' => 9,
- 'name' => 'VIP Player',
- 'pubname' => '',
- 'description' => 'This badge is to thank you for supporting us with a subscription purchase. Words cannot express our gratitude for your support. Thank you!!!',
- 'pubdescription' => 'This user has supported us with a subscription purchase. Words cannot express our gratitude for the support.',
- 'points' => 0,
- ]);
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->delete('badge',['id' => 9]);
- }
-}
diff --git a/backend/modules/sales/migrations/m230114_000209_drop_price_related_columns_from_product_table.php b/backend/modules/sales/migrations/m230114_000209_drop_price_related_columns_from_product_table.php
deleted file mode 100644
index 7d63772b8..000000000
--- a/backend/modules/sales/migrations/m230114_000209_drop_price_related_columns_from_product_table.php
+++ /dev/null
@@ -1,33 +0,0 @@
-dropColumn('product', 'price_id');
- $this->dropColumn('product', 'currency');
- $this->dropColumn('product', 'unit_amount');
- $this->dropColumn('product', 'interval');
- $this->dropColumn('product', 'interval_count');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->addColumn('product', 'price_id', $this->string(40)->notNull());
- $this->addColumn('product', 'currency',$this->string(40)->notNull());
- $this->addColumn('product', 'unit_amount',$this->bigInteger()->notNull()->defaultValue(0));
- $this->addColumn('product', 'interval',$this->string(20)->notNull()->defaultValue('day'));
- $this->addColumn('product', 'interval_count',$this->bigInteger()->notNull()->defaultValue(1));
- }
-}
diff --git a/backend/modules/sales/migrations/m230114_004732_update_do_subscription_expiration_procedure_fix_price_id.php b/backend/modules/sales/migrations/m230114_004732_update_do_subscription_expiration_procedure_fix_price_id.php
deleted file mode 100644
index 1d4406e92..000000000
--- a/backend/modules/sales/migrations/m230114_004732_update_do_subscription_expiration_procedure_fix_price_id.php
+++ /dev/null
@@ -1,45 +0,0 @@
-db->createCommand($this->DROP_SQL)->execute();
- $this->db->createCommand($this->CREATE_SQL)->execute();
- }
-
- public function down()
- {
- $this->db->createCommand($this->DROP_SQL)->execute();
- }
-}
diff --git a/schemas/echoCTF-events.sql b/schemas/echoCTF-events.sql
index 01b1a5179..570eb265a 100644
--- a/schemas/echoCTF-events.sql
+++ b/schemas/echoCTF-events.sql
@@ -1,44 +1,49 @@
SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DELIMITER ;;
-DELIMITER //
+--
+-- Dumping events for database 'echoCTF'
+--
+DROP EVENT IF EXISTS `ev_player_token_expiration` ;;
+CREATE EVENT `ev_player_token_expiration` ON SCHEDULE EVERY 10 SECOND STARTS '2024-11-06 12:26:52' ON COMPLETION PRESERVE ENABLE DO BEGIN
+ ALTER EVENT `ev_player_token_expiration` DISABLE;
+ call expire_player_tokens();
+ ALTER EVENT `ev_player_token_expiration` ENABLE;
+ END ;;
-DROP EVENT IF EXISTS `update_player_ranks` //
-CREATE EVENT `update_player_ranks` ON SCHEDULE EVERY 1 MINUTE ON COMPLETION PRESERVE ENABLE DO
-BEGIN
- call calculate_ranks();
- call calculate_country_rank();
-END //
+DROP EVENT IF EXISTS `player_maintenance` ;;
+CREATE EVENT `player_maintenance` ON SCHEDULE EVERY 1 DAY STARTS '2020-01-01 00:00:00' ON COMPLETION PRESERVE ENABLE DO BEGIN
+ CALL player_maintenance();
+ END ;;
-DROP EVENT IF EXISTS `update_player_last_seen` //
-CREATE EVENT `update_player_last_seen` ON SCHEDULE EVERY 1 HOUR ON COMPLETION PRESERVE ENABLE DO
-BEGIN
- UPDATE `player_last` SET `on_pui`=FROM_UNIXTIME(memc_get(CONCAT('last_seen:',id))) WHERE memc_get(CONCAT('last_seen:',id)) IS NOT NULL;
-END //
+DROP EVENT IF EXISTS `rotate_notifications` ;;
+CREATE EVENT `rotate_notifications` ON SCHEDULE EVERY 12 HOUR STARTS '2023-04-03 00:00:01' ON COMPLETION PRESERVE ENABLE DO BEGIN
+ ALTER EVENT `rotate_notifications` DISABLE;
+ CALL rotate_notifications(180,(24*3)*60);
+ ALTER EVENT `rotate_notifications` ENABLE;
+ END ;;
-DROP EVENT IF EXISTS `rotate_notifications` //
-CREATE EVENT `rotate_notifications` ON SCHEDULE EVERY 1 DAY ON COMPLETION PRESERVE ENABLE DO
-BEGIN
- DELETE FROM `notification` WHERE `archived`=1 AND `updated_at` < NOW() - INTERVAL 7 DAY;
-END //
+DROP EVENT IF EXISTS `update_player_last_seen` ;;
+CREATE EVENT `update_player_last_seen` ON SCHEDULE EVERY 1 HOUR STARTS '2020-09-14 11:10:05' ON COMPLETION PRESERVE ENABLE DO BEGIN
+ UPDATE `player_last` SET `on_pui`=FROM_UNIXTIME(memc_get(CONCAT('last_seen:',id))) WHERE memc_get(CONCAT('last_seen:',id)) IS NOT NULL;
+END ;;
-DROP EVENT IF EXISTS `player_maintenance` //
-CREATE EVENT `player_maintenance` ON SCHEDULE EVERY 1 DAY STARTS '2020-01-01 00:00:00' ON COMPLETION PRESERVE ENABLE DO
-BEGIN
- DELETE FROM `player` WHERE `created` < NOW() - INTERVAL 10 DAY AND `status` IN (0,9);
- UPDATE `player` SET `password_reset_token`=NULL WHERE `status`=10 AND `password_reset_token` IS NOT NULL AND FROM_UNIXTIME(SUBSTR(`password_reset_token`,-10)) <= NOW() - INTERVAL 1 DAY;
-END //
+DROP EVENT IF EXISTS `update_ranks` ;;
+CREATE EVENT `update_ranks` ON SCHEDULE EVERY 30 SECOND STARTS '2021-01-11 12:26:44' ON COMPLETION PRESERVE ENABLE DO BEGIN
+ ALTER EVENT `update_ranks` DISABLE;
+ call calculate_ranks();
+ call calculate_country_rank();
+ call calculate_team_ranks();
+ ALTER EVENT `update_ranks` ENABLE;
+ END ;;
---
--- This event can be used in heavy loaded systems to calculate the timers for the
--- headshots after they have been assigned. This will require modifications to
--- the tai_player_finding and tai_player_treasure.
---
--- DROP EVENT IF EXISTS `update_headshot_timers` //
--- CREATE EVENT `update_headshot_timers` ON SCHEDULE EVERY 10 SECOND ON COMPLETION PRESERVE ENABLE DO
--- BEGIN
--- DECLARE ltarget_id,lplayer_id INT;
--- ALTER EVENT `update_headshot_timers` DISABLE;
--- SELECT target_id,player_id INTO ltarget_id,lplayer_id from headshot where timer=0 order by created_at asc LIMIT 1;
--- CALL time_headshot(lplayer_id,ltarget_id);
--- ALTER EVENT `update_headshot_timers` ENABLE;
--- END //
+DELIMITER ;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
diff --git a/schemas/echoCTF-routines.sql b/schemas/echoCTF-routines.sql
index f83bcc246..2e8c5e0e5 100644
--- a/schemas/echoCTF-routines.sql
+++ b/schemas/echoCTF-routines.sql
@@ -1,24 +1,47 @@
---
--- Dumping routines for database 'echoCTF_dev'
---
SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
-
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DELIMITER ;;
+--
+-- Dumping routines for database 'echoCTF'
+--
DROP FUNCTION IF EXISTS `NTOHS` ;;
-CREATE FUNCTION `NTOHS`(n SMALLINT UNSIGNED) RETURNS smallint(5) unsigned DETERMINISTIC
+CREATE FUNCTION `NTOHS`(n SMALLINT UNSIGNED) RETURNS smallint(5) unsigned
+ DETERMINISTIC
return ((((n & 0xFF)) << 8) | ((n & 0xFF00) >> 8)) ;;
DROP FUNCTION IF EXISTS `SPLIT_STR` ;;
-CREATE FUNCTION `SPLIT_STR`( x VARCHAR(255), delim VARCHAR(12), pos INT) RETURNS varchar(255) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci
+CREATE FUNCTION `SPLIT_STR`(x VARCHAR(255), delim VARCHAR(12), pos INT) RETURNS varchar(255) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci
DETERMINISTIC
RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos),
LENGTH(SUBSTRING_INDEX(x, delim, pos -1)) + 1),
delim, '') ;;
+DROP FUNCTION IF EXISTS `target_solved_percentage` ;;
+CREATE FUNCTION `target_solved_percentage`(n INT UNSIGNED) RETURNS float
+ READS SQL DATA
+BEGIN
+ DECLARE average_pct float;
+ SET average_pct=(select ((select count(*) from headshot where target_id=n)*100)/count(distinct player_id) from stream where (model='finding' and model_id in (select id from finding where target_id=n)) or (model='treasure' and model_id in (select id from treasure where target_id=n)));
+ RETURN average_pct;
+ END ;;
+
+DROP FUNCTION IF EXISTS `target_started_count` ;;
+CREATE FUNCTION `target_started_count`(n INT UNSIGNED) RETURNS int(11)
+ READS SQL DATA
+BEGIN
+DECLARE counter INT;
+SET counter=(select count(distinct player_id) from stream where (model='finding' and model_id in (select id from finding where target_id=n)) or (model='treasure' and model_id in (select id from treasure where target_id=n)));
+RETURN counter;
+END ;;
+
DROP FUNCTION IF EXISTS `TS_AGO` ;;
-CREATE FUNCTION `TS_AGO`( x TIMESTAMP) RETURNS varchar(255) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci
+CREATE FUNCTION `TS_AGO`(x TIMESTAMP) RETURNS varchar(255) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci
DETERMINISTIC
BEGIN
DECLARE minutes,seconds,hours,months,days INTEGER;
@@ -59,6 +82,7 @@ BEGIN
RETURN CONCAT(' just now');
END ;;
+
DROP PROCEDURE IF EXISTS `add_badge_stream` ;;
CREATE PROCEDURE `add_badge_stream`(IN usid BIGINT, IN tbl VARCHAR(255), IN recid INT)
BEGIN
@@ -70,19 +94,15 @@ BEGIN
END ;;
DROP PROCEDURE IF EXISTS `add_finding_stream` ;;
-CREATE PROCEDURE `add_finding_stream`(IN usid BIGINT, IN tbl VARCHAR(255), IN recid INT)
+CREATE PROCEDURE `add_finding_stream`(IN usid BIGINT, IN tbl VARCHAR(255), IN recid INT, IN pts FLOAT)
BEGIN
DECLARE ltitle,lpubtitle VARCHAR(255);
DECLARE lmessage,lpubmessage TEXT;
- DECLARE pts,ltid BIGINT;
- SELECT name,pubname,description,pubdescription,points,target_id INTO ltitle,lpubtitle,lmessage,lpubmessage,pts,ltid FROM finding WHERE id=recid;
- IF (SELECT count(*) FROM player_target_help WHERE target_id=ltid AND player_id=usid)>0 THEN
- SET pts=pts/2;
- END IF;
+ DECLARE ltid BIGINT;
+ SELECT name,pubname,description,pubdescription,target_id INTO ltitle,lpubtitle,lmessage,lpubmessage,ltid FROM finding WHERE id=recid;
INSERT INTO stream (player_id,model,model_id,points,title,message,pubtitle,pubmessage,ts) VALUES (usid,'finding',recid,pts,ltitle,lmessage,lpubtitle,lpubmessage,now());
END ;;
-
DROP PROCEDURE IF EXISTS `add_player_finding_hint` ;;
CREATE PROCEDURE `add_player_finding_hint`(p_id INT,f_id INT)
BEGIN
@@ -97,6 +117,7 @@ BEGIN
AND `active`=1;
END ;;
+
DROP PROCEDURE IF EXISTS `add_player_treasure_hint` ;;
CREATE PROCEDURE `add_player_treasure_hint`(p_id INT,f_id INT)
BEGIN
@@ -109,6 +130,7 @@ BEGIN
AND `active`=1;
END ;;
+
DROP PROCEDURE IF EXISTS `add_question_stream` ;;
CREATE PROCEDURE `add_question_stream`(IN usid BIGINT, IN tbl VARCHAR(255), IN recid INT)
BEGIN
@@ -120,6 +142,7 @@ BEGIN
INSERT INTO stream (player_id,model,model_id,points,title,message,pubtitle,pubmessage,ts) VALUES (usid,'question',recid,pts,lname,ldescription,lname,ldescription,now());
END ;;
+
DROP PROCEDURE IF EXISTS `add_report_stream` ;;
CREATE PROCEDURE `add_report_stream`(IN usid BIGINT, IN tbl VARCHAR(255), IN recid INT)
BEGIN
@@ -130,44 +153,182 @@ BEGIN
INSERT INTO stream (player_id,model,model_id,points,title,message,pubtitle,pubmessage,ts) VALUES (usid,'report',recid,pts,ltitle,lbody,lpubtitle,lpubbody,now());
END ;;
+
DROP PROCEDURE IF EXISTS `add_stream` ;;
CREATE PROCEDURE `add_stream`(IN usid BIGINT, IN tbl VARCHAR(255), IN recid INT)
BEGIN
CASE tbl
- WHEN 'badge' THEN CALL add_badge_stream(usid,tbl,recid);
- WHEN 'treasure' THEN CALL add_treasure_stream(usid,tbl,recid);
+-- WHEN 'user' THEN CALL add_user_stream(usid,tbl,recid);
WHEN 'finding' THEN CALL add_finding_stream(usid,tbl,recid);
- WHEN 'report' THEN CALL add_report_stream(usid,tbl,recid);
+ WHEN 'treasure' THEN CALL add_treasure_stream(usid,tbl,recid);
WHEN 'question' THEN CALL add_question_stream(usid,tbl,recid);
+ WHEN 'badge' THEN CALL add_badge_stream(usid,tbl,recid);
+-- WHEN 'headshot' THEN CALL add_headshot_stream(usid,tbl,recid);
+-- WHEN 'challenge' THEN CALL add_challenge_stream(usid,tbl,recid);
+ WHEN 'report' THEN CALL add_report_stream(usid,tbl,recid);
END CASE;
END ;;
DROP PROCEDURE IF EXISTS `add_treasure_stream` ;;
-CREATE PROCEDURE `add_treasure_stream`(IN usid BIGINT, IN tbl VARCHAR(255), IN recid INT)
+CREATE PROCEDURE `add_treasure_stream`(IN usid BIGINT, IN tbl VARCHAR(255), IN recid INT, IN pts FLOAT)
BEGIN
DECLARE ltitle,lpubtitle VARCHAR(255);
DECLARE lmessage,lpubmessage TEXT;
DECLARE divider INTEGER DEFAULT 1;
- DECLARE pts,ltid BIGINT;
- SELECT name,pubname,description,pubdescription,points,target_id INTO ltitle,lpubtitle,lmessage,lpubmessage,pts,ltid FROM treasure WHERE id=recid;
- IF (SELECT count(*) FROM player_target_help WHERE target_id=ltid AND player_id=usid)>0 THEN
- SET pts=pts/2;
- END IF;
+ DECLARE ltid BIGINT;
+
+ SELECT name,pubname,description,pubdescription,target_id INTO ltitle,lpubtitle,lmessage,lpubmessage,ltid FROM treasure WHERE id=recid;
INSERT INTO stream (player_id,model,model_id,points,title,message,pubtitle,pubmessage,ts) VALUES (usid,'treasure',recid,pts,ltitle,lmessage,lpubtitle,lpubmessage,now());
END ;;
+DROP PROCEDURE IF EXISTS `calculate_country_rank` ;;
+CREATE PROCEDURE `calculate_country_rank`()
+BEGIN
+ DECLARE done INT DEFAULT FALSE;
+ DECLARE ccode VARCHAR(3);
+ DECLARE cur1 CURSOR FOR SELECT DISTINCT country FROM profile;
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+ CREATE TEMPORARY TABLE country_ranking (id int primary key AUTO_INCREMENT,player_id int) ENGINE=MEMORY;
+ OPEN cur1;
+ read_loop: LOOP
+ FETCH cur1 INTO ccode;
+ IF done THEN
+ LEAVE read_loop;
+ END IF;
+ START TRANSACTION;
+ delete from player_country_rank WHERE country=ccode;
+ insert into country_ranking SELECT NULL,t.player_id FROM player_score AS t
+ LEFT JOIN player AS t2 ON t.player_id=t2.id
+ LEFT JOIN profile AS t3 ON t.player_id=t3.player_id
+ WHERE t2.active=1 and t2.status=10 AND t3.country=ccode ORDER BY points DESC,t.ts ASC, t.player_id ASC;
+ insert into player_country_rank select *,ccode from country_ranking ON DUPLICATE KEY UPDATE id=values(id),country=values(country);
+ COMMIT;
+ TRUNCATE country_ranking;
+ END LOOP;
+ CLOSE cur1;
+ DROP TABLE country_ranking;
+END ;;
+
DROP PROCEDURE IF EXISTS `calculate_ranks` ;;
CREATE PROCEDURE `calculate_ranks`()
BEGIN
-CREATE TEMPORARY TABLE `ranking` (id int primary key AUTO_INCREMENT,player_id int) ENGINE=MEMORY;
-START TRANSACTION;
- delete from player_rank;
- insert into ranking select NULL,t.player_id from player_score as t left join player as t2 on t.player_id=t2.id where t2.active=1 order by points desc,t.ts asc, t.player_id asc;
- insert into player_rank select * from ranking;
-COMMIT;
-DROP TABLE `ranking`;
+ DECLARE v_max INT unsigned DEFAULT 0;
+ DECLARE v_counter INT unsigned DEFAULT 0;
+ SET v_max=(SELECT IFNULL(memc_get('sysconfig:academic_grouping'),0));
+
+ DROP TABLE IF EXISTS pr_ranking;
+
+ IF v_max = 0 THEN
+ CREATE TEMPORARY TABLE `pr_ranking` (id int primary key AUTO_INCREMENT,player_id int) ENGINE=MEMORY CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+ START TRANSACTION;
+ delete from player_rank;
+ insert into pr_ranking select NULL,t.player_id from player_score as t left join player as t2 on t.player_id=t2.id where t2.active=1 and t2.status=10 order by points desc,t.ts asc, t.player_id asc;
+ insert IGNORE into player_rank select * from pr_ranking;
+ COMMIT;
+ DROP TABLE `pr_ranking`;
+ ELSE
+ REPEAT
+ CREATE TEMPORARY TABLE `pr_ranking` (id int primary key AUTO_INCREMENT,player_id int) ENGINE=MEMORY CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+ START TRANSACTION;
+ delete from player_rank where player_id in (select id from player where academic=v_counter) OR player_id NOT IN (select id from player);
+ insert into pr_ranking select NULL,t.player_id from player_score as t left join player as t2 on t.player_id=t2.id where t2.active=1 and t2.status=10 and t2.academic=v_counter order by points desc,t.ts asc, t.player_id asc;
+ insert IGNORE into player_rank select * from pr_ranking;
+ COMMIT;
+ DROP TABLE `pr_ranking`;
+ SET v_counter=v_counter+1;
+ UNTIL v_counter >= v_max
+ END REPEAT;
+ END IF;
END ;;
+DROP PROCEDURE IF EXISTS `calculate_team_ranks` ;;
+CREATE PROCEDURE `calculate_team_ranks`()
+BEGIN
+ DECLARE v_max INT unsigned DEFAULT 0;
+ DECLARE v_counter INT unsigned DEFAULT 0;
+
+ SET v_max=(SELECT IFNULL(memc_get('sysconfig:academic_grouping'),0));
+
+ DROP TABLE IF EXISTS `tr_ranking`;
+
+ IF v_max = 0 THEN
+ CREATE TEMPORARY TABLE `tr_ranking` (id int primary key AUTO_INCREMENT,team_id int) ENGINE=MEMORY CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+ START TRANSACTION;
+ delete from team_rank;
+ insert into tr_ranking select NULL,t.team_id from team_score as t left join team as t2 on t.team_id=t2.id ORDER BY points desc,t.ts asc, t.team_id asc;
+ insert IGNORE into team_rank select * from tr_ranking;
+ COMMIT;
+ DROP TABLE `tr_ranking`;
+ ELSE
+ IF (SELECT count(*) FROM sysconfig WHERE id='teams')>0 AND (SELECT val FROM sysconfig WHERE id='teams')=1 THEN
+ REPEAT
+ CREATE TEMPORARY TABLE `tr_ranking` (id int primary key AUTO_INCREMENT,team_id int) ENGINE=MEMORY CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+ START TRANSACTION;
+ -- DELETE team of a given academic category or no longer exist in the table
+ delete from team_rank where team_id in (select id from team where academic=v_counter) OR team_id NOT IN (select id from team);
+ insert into tr_ranking select NULL,t.team_id from team_score as t left join team as t2 on t.team_id=t2.id WHERE t2.academic=v_counter order by points desc,t.ts asc, t.team_id asc;
+ insert IGNORE into team_rank select * from tr_ranking;
+ COMMIT;
+ DROP TABLE `tr_ranking`;
+ SET v_counter=v_counter+1;
+ UNTIL v_counter >= v_max
+ END REPEAT;
+ END IF;
+ END IF;
+END ;;
+
+DROP PROCEDURE IF EXISTS `expire_player_tokens` ;;
+CREATE PROCEDURE `expire_player_tokens`()
+BEGIN
+ DECLARE tnow TIMESTAMP;
+ SET tnow=NOW();
+ IF (SELECT COUNT(*) FROM player_token WHERE expires_at0 THEN
+ START TRANSACTION;
+ INSERT INTO notification (player_id,category,title,body,archived,created_at,updated_at) SELECT player_id,'info','Token expiration',CONCAT(type,' Token [',description,'] expired at ',expires_at),0,tnow,tnow FROM player_token WHERE expires_at0 THEN
+ DELETE FROM player_token WHERE expires_at0 THEN
+ INSERT INTO stream (player_id,model,model_id,points,title,message,pubtitle,pubmessage,ts) VALUES (pid,'challenge',tid,0,'','','','',max_val);
+ END IF;
+ END IF;
+
+END ;;
DROP PROCEDURE IF EXISTS `give_headshot` ;;
@@ -180,17 +341,81 @@ BEGIN
END IF;
END ;;
+DROP PROCEDURE IF EXISTS `init_mysql` ;;
+CREATE PROCEDURE `init_mysql`()
+BEGIN
+ IF (SELECT val FROM sysconfig WHERE id='time_zone') IS NOT NULL THEN
+ SET GLOBAL time_zone=(SELECT val FROM sysconfig WHERE id='time_zone');
+ END IF;
+ call populate_memcache();
+ call calculate_ranks();
+ call calculate_country_rank();
+ call calculate_team_ranks();
+END ;;
-DROP PROCEDURE IF EXISTS `time_headshot` ;;
-CREATE PROCEDURE `time_headshot` (IN pid INT, IN tid INT)
+DROP PROCEDURE IF EXISTS `player_maintenance` ;;
+CREATE PROCEDURE `player_maintenance`()
BEGIN
- DECLARE min_finding,min_treasure,max_finding,max_treasure, max_val, min_val DATETIME;
- SELECT min(ts),max(ts) INTO min_finding,max_finding FROM `player_finding` WHERE `player_id`=pid AND `finding_id` IN (SELECT `id` FROM `finding` WHERE `target_id`=tid);
- SELECT min(ts),max(ts) INTO min_treasure,max_treasure FROM `player_treasure` WHERE `player_id`=pid AND `treasure_id` IN (SELECT `id` FROM `treasure` WHERE `target_id`=tid);
- SELECT GREATEST(max_finding, max_treasure), LEAST(min_finding, min_treasure) INTO max_val,min_val;
- UPDATE `headshot` SET `timer`=UNIX_TIMESTAMP(max_val)-UNIX_TIMESTAMP(min_val) WHERE `player_id`=pid AND `target_id`=tid;
+ DECLARE player_require_approval,player_delete_inactive_after,player_delete_deleted_after,player_changed_to_deleted_after,player_delete_rejected_after INT;
+ SET player_require_approval=memc_get('sysconfig:player_require_approval');
+ SET player_delete_inactive_after=memc_get('sysconfig:player_delete_inactive_after');
+ SET player_delete_deleted_after=memc_get('sysconfig:player_delete_deleted_after');
+ SET player_changed_to_deleted_after=memc_get('sysconfig:player_changed_to_deleted_after');
+ SET player_delete_rejected_after=memc_get('sysconfig:player_delete_rejected_after');
+
+ IF player_require_approval IS NOT NULL and player_require_approval>0 AND player_delete_rejected_after IS NOT NULL AND player_delete_rejected_after>0 THEN
+ -- DELETE players who have been rejected after 5 days
+ SELECT 'player_require_approval' as '';
+ DELETE FROM `player` WHERE `ts` < NOW() - INTERVAL player_delete_rejected_after DAY AND `status`=9 AND approval=4;
+ END IF;
+ IF player_delete_inactive_after IS NOT NULL AND player_delete_inactive_after > 0 THEN
+ SELECT 'player_delete_inactive_after' as '';
+ DELETE FROM `player` WHERE `ts` < NOW() - INTERVAL player_delete_inactive_after DAY AND `status`=9;
+ END IF;
+ IF player_delete_deleted_after IS NOT NULL AND player_delete_deleted_after > 0 THEN
+ SELECT 'player_delete_deleted_after' as '';
+ DELETE FROM `player` WHERE `ts` < NOW() - INTERVAL player_delete_deleted_after DAY AND `status`=0;
+ END IF;
+ IF player_changed_to_deleted_after IS NOT NULL AND player_changed_to_deleted_after > 0 THEN
+ UPDATE player SET status=0 WHERE status=8 AND ts < NOW() - INTERVAL player_changed_to_deleted_after DAY;
+ END IF;
+END ;;
+
+DROP PROCEDURE IF EXISTS `populate_memcache` ;;
+CREATE PROCEDURE `populate_memcache`()
+BEGIN
+ select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
+ INSERT INTO devnull SELECT memc_set(CONCAT('player:',id),id) FROM player;
+ INSERT INTO devnull SELECT memc_set(CONCAT('player_type:',id),`type`) FROM player;
+ INSERT INTO devnull SELECT memc_set(CONCAT('team_player:',player_id),team_id) FROM team_player;
+ INSERT INTO devnull SELECT memc_set(CONCAT('team_finding:',t2.team_id, ':', t1.finding_id),t1.player_id) FROM player_finding AS t1 LEFT JOIN team_player AS t2 ON t2.player_id=t1.player_id;
+ INSERT INTO devnull SELECT memc_set(CONCAT('player_finding:',player_id, ':', finding_id),player_id) FROM player_finding;
+ INSERT INTO devnull SELECT memc_set(CONCAT('target:',ip),id) FROM target;
+ INSERT INTO devnull SELECT memc_set(CONCAT('target:',id),ip) FROM target;
+ INSERT INTO devnull SELECT memc_set(CONCAT('sysconfig:',id),val) FROM sysconfig;
+ INSERT INTO devnull SELECT memc_set(CONCAT('finding:',protocol,':',ifnull(port,0), ':', target_id ),id) FROM finding;
+ DO memc_set('sysconfig_json',(SELECT CONCAT('[',GROUP_CONCAT(JSON_OBJECT('id', id,'val',val) ORDER BY id),']') FROM sysconfig WHERE id NOT LIKE 'CA%' and id NOT IN ('disabled_routes','frontpage_scenario','routes','writeup_rules','vpn-ta.key') ORDER BY id));
+END ;;
+
+DROP PROCEDURE IF EXISTS `repopulate_team_stream` ;;
+CREATE PROCEDURE `repopulate_team_stream`(IN tid INT)
+BEGIN
+ DECLARE `_rollback` BOOL DEFAULT false;
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET `_rollback` = true;
+ IF (SELECT count(*) FROM sysconfig WHERE id='teams')>0 AND (SELECT val FROM sysconfig WHERE id='teams')=1 THEN
+ START TRANSACTION;
+ UPDATE team_score SET points=0 WHERE team_id=tid;
+ DELETE FROM team_stream WHERE team_id=tid;
+ INSERT INTO team_stream SELECT tid,model,model_id,points,ts FROM stream WHERE model!='user' AND player_id IN (select player_id FROM team_player WHERE team_id=tid) GROUP BY model,model_id ORDER BY id,ts;
+ IF `_rollback` THEN
+ ROLLBACK;
+ ELSE
+ COMMIT;
+ END IF;
+ END IF;
END ;;
+
DROP PROCEDURE IF EXISTS `reset_gamedata` ;;
CREATE PROCEDURE `reset_gamedata`()
BEGIN
@@ -206,6 +431,8 @@ BEGIN
DELETE FROM `hint` where id>1;
ALTER TABLE `hint` AUTO_INCREMENT=1;
+ CALL reset_playdata();
+
DELETE FROM `target`;
ALTER TABLE `target` AUTO_INCREMENT=1;
@@ -227,6 +454,7 @@ BEGIN
TRUNCATE sessions;
END ;;
+
DROP PROCEDURE IF EXISTS `reset_player_progress` ;;
CREATE PROCEDURE `reset_player_progress`()
BEGIN
@@ -244,58 +472,38 @@ BEGIN
insert into player_score (player_id,points) select id,0 from player;
END ;;
-DROP PROCEDURE IF EXISTS calculate_country_rank;;
-CREATE PROCEDURE calculate_country_rank ()
+DROP PROCEDURE IF EXISTS `rotate_notifications` ;;
+CREATE PROCEDURE `rotate_notifications`(IN archived_interval_minute INT, IN pending_interval_minute INT)
BEGIN
- DECLARE done INT DEFAULT FALSE;
- DECLARE ccode VARCHAR(3) COLLATE utf8mb4_unicode_ci;
- DECLARE cur1 CURSOR FOR SELECT DISTINCT country FROM profile;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
- CREATE TEMPORARY TABLE country_ranking (id int primary key AUTO_INCREMENT,player_id int) ENGINE=MEMORY;
- OPEN cur1;
- read_loop: LOOP
- FETCH cur1 INTO ccode;
- IF done THEN
- LEAVE read_loop;
- END IF;
- START TRANSACTION;
- delete from player_country_rank WHERE country=ccode;
- insert into country_ranking SELECT NULL,t.player_id FROM player_score AS t
- LEFT JOIN player AS t2 ON t.player_id=t2.id
- LEFT JOIN profile AS t3 ON t.player_id=t3.player_id
- WHERE t2.active=1 AND t3.country=ccode ORDER BY points DESC,t.ts ASC, t.player_id ASC;
- insert into player_country_rank select *,ccode from country_ranking ON DUPLICATE KEY UPDATE id=values(id),country=values(country);
- COMMIT;
- TRUNCATE country_ranking;
- END LOOP;
- CLOSE cur1;
- DROP TABLE country_ranking;
+ DELETE FROM `notification` WHERE
+ (`archived`=1 AND DATE(`updated_at`) < NOW() - INTERVAL archived_interval_minute MINUTE) OR
+ (created_at IS null AND updated_at IS null) OR
+ (title LIKE '%target%' and DATE(created_at) < NOW() - INTERVAL pending_interval_minute MINUTE);
END ;;
-DROP PROCEDURE IF EXISTS populate_memcache;;
-CREATE PROCEDURE populate_memcache ()
+DROP PROCEDURE IF EXISTS `time_headshot` ;;
+CREATE PROCEDURE `time_headshot`(IN pid INT, IN tid INT)
BEGIN
- select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
- INSERT INTO devnull SELECT memc_set(CONCAT('player:',id),id) FROM player;
- INSERT INTO devnull SELECT memc_set(CONCAT('player_type:',id),`type`) FROM player;
- INSERT INTO devnull SELECT memc_set(CONCAT('team_player:',player_id),team_id) FROM team_player;
- INSERT INTO devnull SELECT memc_set(CONCAT('team_finding:',t2.team_id, ':', t1.finding_id),t1.player_id) FROM player_finding AS t1 LEFT JOIN team_player AS t2 ON t2.player_id=t1.player_id;
- INSERT INTO devnull SELECT memc_set(CONCAT('player_finding:',player_id, ':', finding_id),player_id) FROM player_finding;
- INSERT INTO devnull SELECT memc_set(CONCAT('target:',ip),id) FROM target;
- INSERT INTO devnull SELECT memc_set(CONCAT('target:',id),ip) FROM target;
- INSERT INTO devnull SELECT memc_set(CONCAT('sysconfig:',id),val) FROM sysconfig;
- INSERT INTO devnull SELECT memc_set(CONCAT('finding:',protocol,':',ifnull(port,0), ':', target_id ),id) FROM finding;
+ DECLARE min_finding,min_treasure,max_finding,max_treasure, max_val, min_val DATETIME;
+ SELECT min(ts),max(ts) INTO min_finding,max_finding FROM `player_finding` WHERE `player_id`=pid AND `finding_id` IN (SELECT `id` FROM `finding` WHERE `target_id`=tid);
+ SELECT min(ts),max(ts) INTO min_treasure,max_treasure FROM `player_treasure` WHERE `player_id`=pid AND `treasure_id` IN (SELECT `id` FROM `treasure` WHERE `target_id`=tid);
+ SELECT GREATEST(max_finding, max_treasure), LEAST(min_finding, min_treasure) INTO max_val,min_val;
+ UPDATE `headshot` SET `timer`=UNIX_TIMESTAMP(max_val)-UNIX_TIMESTAMP(min_val) WHERE `player_id`=pid AND `target_id`=tid;
END ;;
-DROP PROCEDURE IF EXISTS init_mysql;;
-CREATE PROCEDURE init_mysql ()
+DROP PROCEDURE IF EXISTS `time_headshot_with_player` ;;
+CREATE PROCEDURE `time_headshot_with_player`(IN pid INT, IN tid INT, IN aspid INT)
BEGIN
- IF (SELECT val FROM sysconfig WHERE id='time_zone') IS NOT NULL THEN
- SET GLOBAL time_zone=(SELECT val FROM sysconfig WHERE id='time_zone');
- END IF;
- call populate_memcache();
- call calculate_ranks();
- call calculate_country_rank();
- call calculate_team_ranks();
+ DECLARE min_finding,min_treasure,max_finding,max_treasure, max_val, min_val DATETIME;
+ SELECT min(ts),max(ts) INTO min_finding,max_finding FROM player_finding WHERE player_id IN (pid, aspid) AND finding_id IN (SELECT id FROM finding WHERE target_id=tid);
+ SELECT min(ts),max(ts) INTO min_treasure,max_treasure FROM player_treasure WHERE player_id IN (pid,aspid) AND treasure_id IN (SELECT id FROM treasure WHERE target_id=tid);
+ SELECT GREATEST(max_finding, max_treasure), LEAST(min_finding, min_treasure) INTO max_val,min_val;
+ UPDATE `headshot` SET timer=UNIX_TIMESTAMP(max_val)-UNIX_TIMESTAMP(min_val) WHERE player_id=pid AND target_id=tid;
END ;;
+
+DELIMITER ;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
diff --git a/schemas/echoCTF-triggers.sql b/schemas/echoCTF-triggers.sql
index b9f76d992..4d18bebc8 100644
--- a/schemas/echoCTF-triggers.sql
+++ b/schemas/echoCTF-triggers.sql
@@ -1,37 +1,89 @@
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8mb4 */;
+SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
-
DELIMITER ;;
-DROP TRIGGER IF EXISTS `tau_report` ;;
---
--- When a new finding is added, update memcached with the finding details
---
-DROP TRIGGER IF EXISTS `tai_finding` ;;
-CREATE TRIGGER `tai_finding` AFTER INSERT ON `finding` FOR EACH ROW
+DROP TRIGGER IF EXISTS tbd_challenge ;;
+CREATE TRIGGER `tbd_challenge` BEFORE DELETE ON `challenge` FOR EACH ROW
thisBegin:BEGIN
- IF (@TRIGGER_CHECKS = FALSE) THEN
+IF (@TRIGGER_CHECKS = FALSE) THEN
LEAVE thisBegin;
- END IF;
+END IF;
+ DELETE FROM stream WHERE `model`='question' AND model_id IN (SELECT id FROM question WHERE challenge_id=OLD.ID);
+ DELETE FROM team_stream WHERE `model`='question' AND model_id IN (SELECT id FROM question WHERE challenge_id=OLD.ID);
+END ;;
- IF (select memc_server_count()<1) THEN
- select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
- END IF;
- SELECT memc_set(CONCAT('finding:',NEW.protocol,':',ifnull(NEW.port,0), ':', NEW.target_id ),NEW.id) INTO @devnull;
+DROP TRIGGER IF EXISTS tad_challenge ;;
+CREATE TRIGGER `tad_challenge` AFTER DELETE ON `challenge` FOR EACH ROW
+thisBegin:BEGIN
+IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+END IF;
+ DELETE FROM stream WHERE `model`='challenge' AND model_id=OLD.id;
+ DELETE FROM team_stream WHERE `model`='challenge' AND model_id=OLD.id;
END ;;
---
--- When a finding is updated also update the relevant memcached values
---
-DROP TRIGGER IF EXISTS `tau_finding` ;;
+DROP TRIGGER IF EXISTS tbi_challenge_solver ;;
+CREATE TRIGGER `tbi_challenge_solver` BEFORE INSERT ON `challenge_solver` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ IF (SELECT count(*) FROM challenge_solver WHERE challenge_id=NEW.challenge_id)=0 THEN
+ SET NEW.first=1;
+ END IF;
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_disabled_route ;;
+CREATE TRIGGER `tai_disabled_route` AFTER INSERT ON `disabled_route` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE routes LONGTEXT;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ SET routes:=(SELECT CONCAT('[',GROUP_CONCAT(JSON_OBJECT('route', route) ORDER BY route),']') FROM disabled_route ORDER BY route);
+ INSERT INTO sysconfig (id,val) VALUES ('disabled_routes',routes) ON DUPLICATE KEY UPDATE val=VALUES(val);
+ END ;;
+
+DROP TRIGGER IF EXISTS tau_disabled_route ;;
+CREATE TRIGGER `tau_disabled_route` AFTER UPDATE ON `disabled_route` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE routes LONGTEXT;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ SET routes:=(SELECT CONCAT('[',GROUP_CONCAT(JSON_OBJECT('route', route) ORDER BY route),']') FROM disabled_route ORDER BY route);
+ INSERT INTO sysconfig (id,val) VALUES ('disabled_routes',routes) ON DUPLICATE KEY UPDATE val=VALUES(val);
+ END ;;
+
+DROP TRIGGER IF EXISTS tad_disabled_route ;;
+CREATE TRIGGER `tad_disabled_route` AFTER DELETE ON `disabled_route` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE routes LONGTEXT;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ SET routes:=(SELECT CONCAT('[',GROUP_CONCAT(JSON_OBJECT('route', route) ORDER BY route),']') FROM disabled_route ORDER BY route);
+ INSERT INTO sysconfig (id,val) VALUES ('disabled_routes',routes) ON DUPLICATE KEY UPDATE val=VALUES(val);
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_finding ;;
+CREATE TRIGGER `tai_finding` AFTER INSERT ON `finding` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ IF (select memc_server_count()<1) THEN
+ select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
+ END IF;
+ DO memc_set(CONCAT('finding:',NEW.protocol,':',ifnull(NEW.port,0), ':', NEW.target_id ),NEW.id);
+ UPDATE target_state SET total_findings=total_findings+1,total_points=total_points+IFNULL(NEW.points,0),finding_points=finding_points+IFNULL(NEW.points,0) WHERE id=NEW.target_id;
+ END ;;
+
+DROP TRIGGER IF EXISTS tau_finding ;;
CREATE TRIGGER `tau_finding` AFTER UPDATE ON `finding` FOR EACH ROW
thisBegin:BEGIN
IF (@TRIGGER_CHECKS = FALSE) THEN
@@ -48,62 +100,117 @@ thisBegin:BEGIN
SELECT memc_set(CONCAT('finding:',NEW.protocol,':',ifnull(NEW.port,0), ':', NEW.target_id ),NEW.id) INTO @devnull;
END ;;
---
--- Ensure we remove the finding details from memcached when a
--- finding is removed
---
-DROP TRIGGER IF EXISTS `tad_finding` ;;
+DROP TRIGGER IF EXISTS tad_finding ;;
CREATE TRIGGER `tad_finding` AFTER DELETE ON `finding` FOR EACH ROW
-thisBegin:BEGIN
- IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
- END IF;
-
- IF (select memc_server_count()<1) THEN
- select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
- END IF;
- SELECT memc_delete(CONCAT('finding:',OLD.protocol,':',ifnull(OLD.port,0), ':', OLD.target_id )) INTO @devnull;
-END ;;
-
-
-DROP TRIGGER IF EXISTS `tai_player` ;;
-CREATE TRIGGER `tai_player` AFTER INSERT ON `player` FOR EACH ROW
-thisBegin:BEGIN
- DECLARE ltitle VARCHAR(20) DEFAULT 'Joined the platform';
-
- IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
- END IF;
-
- IF (select memc_server_count()<1) THEN
- select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
- END IF;
- SELECT memc_set(CONCAT('player_type:',NEW.id), NEW.type) INTO @devnull;
- SELECT memc_set(CONCAT('player:',NEW.id), NEW.id) INTO @devnull;
- INSERT INTO profile (player_id) VALUES (NEW.id);
- INSERT INTO player_last (id,on_pui) VALUES (NEW.id,now());
- INSERT INTO player_spin (player_id,counter,total,updated_at) values (NEW.id,0,0,NOW());
- INSERT INTO player_score (player_id) VALUES (NEW.id);
--- IF NEW.active=1 THEN
--- INSERT INTO stream (player_id,model,model_id,points,title,message,pubtitle,pubmessage,ts) VALUES (NEW.id,'user',NEW.id,0,ltitle,ltitle,ltitle,ltitle,now());
--- END IF;
-END ;;
-
-DROP TRIGGER IF EXISTS `tbu_player` ;;
-CREATE TRIGGER `tbu_player` BEFORE UPDATE ON `player` FOR EACH ROW
-thisBegin:BEGIN
- IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
- END IF;
-
- IF (NEW.status!=OLD.status AND NEW.status=10) THEN
- SET NEW.verification_token=NULL;
- END IF;
-END ;;
-
-DROP TRIGGER IF EXISTS `tau_player` ;;
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ IF (select memc_server_count()<1) THEN
+ select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
+ END IF;
+ DO memc_delete(CONCAT('finding:',OLD.protocol,':',ifnull(OLD.port,0), ':', OLD.target_id ));
+
+ UPDATE target_state SET total_findings=total_findings-1,total_points=total_points-IFNULL(OLD.points,0),finding_points=finding_points-IFNULL(OLD.points,0) WHERE id=OLD.target_id;
+ DELETE FROM stream WHERE model_id=OLD.id AND model='finding';
+ DELETE FROM team_stream WHERE model_id=OLD.id and model='finding';
+ END ;;
+
+DROP TRIGGER IF EXISTS tbi_headshot ;;
+CREATE TRIGGER `tbi_headshot` BEFORE INSERT ON `headshot` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ IF (SELECT count(*) FROM headshot WHERE target_id=NEW.target_id)=0 THEN
+ SET NEW.first=1;
+ END IF;
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_headshot ;;
+CREATE TRIGGER `tai_headshot` AFTER INSERT ON `headshot` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE private_instance int;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ SET private_instance=(SELECT COUNT(*) FROM target_instance WHERE player_id=NEW.player_id AND target_id=NEW.target_id);
+ IF (SELECT headshot_spin FROM target WHERE id=NEW.target_id)>0 AND private_instance<1 THEN
+ INSERT IGNORE INTO spin_queue (target_id, player_id,created_at) VALUES (NEW.target_id,NEW.player_id,NOW());
+ ELSEIF private_instance>0 THEN
+ UPDATE target_instance SET reboot=2 WHERE player_id=NEW.player_id AND target_id=NEW.target_id;
+ END IF;
+ IF (SELECT count(*) FROM target_ondemand WHERE target_id=NEW.target_id AND state=1)>0 THEN
+ UPDATE target_ondemand SET heartbeat=(NOW() - INTERVAL 59 MINUTE - INTERVAL 30 SECOND) WHERE target_id=NEW.target_id;
+ END IF;
+ UPDATE target_state SET total_headshots=total_headshots+1,timer_avg=(SELECT ifnull(round(avg(timer)),0) FROM headshot WHERE target_id=NEW.target_id) WHERE id=NEW.target_id;
+ END ;;
+
+DROP TRIGGER IF EXISTS tau_headshot ;;
+CREATE TRIGGER `tau_headshot` AFTER UPDATE ON `headshot` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ IF (OLD.rating IS NULL AND NEW.rating IS NOT NULL) OR (OLD.rating IS NOT NULL and NEW.rating!=OLD.rating) THEN
+ UPDATE target_state SET player_rating=(SELECT round(avg(rating)) FROM headshot WHERE target_id=NEW.target_id AND rating>-1) WHERE id=NEW.target_id;
+ END IF;
+ IF (OLD.timer IS NULL AND NEW.timer IS NOT NULL) OR (OLD.timer IS NOT NULL AND NEW.timer!=OLD.timer) THEN
+ UPDATE target_state SET timer_avg=(SELECT round(avg(timer)) FROM headshot WHERE target_id=NEW.target_id and timer>60) WHERE id=NEW.target_id;
+ END IF;
+ END ;;
+
+DROP TRIGGER IF EXISTS tad_headshot ;;
+CREATE TRIGGER `tad_headshot` AFTER DELETE ON `headshot` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ UPDATE target_state SET total_headshots=total_headshots-1,timer_avg=(SELECT ifnull(round(avg(timer)),0) FROM headshot WHERE target_id=OLD.target_id) WHERE id=OLD.target_id;
+ DELETE FROM stream WHERE model_id=OLD.target_id and model='headshot';
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_network_target ;;
+CREATE TRIGGER `tai_network_target` AFTER INSERT ON `network_target` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ UPDATE target_state SET on_network=1 WHERE id=NEW.target_id and on_network!=1;
+ END ;;
+
+DROP TRIGGER IF EXISTS tad_network_target ;;
+CREATE TRIGGER `tad_network_target` AFTER DELETE ON `network_target` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ UPDATE target_state SET on_network=ifnull((select 1 from network_target where target_id=OLD.target_id),0) WHERE id=OLD.target_id;
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_player ;;
+CREATE TRIGGER tai_player AFTER INSERT ON player FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE ltitle VARCHAR(20) DEFAULT 'Joined the platform';
+
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+
+ IF (select memc_server_count()<1) THEN
+ select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
+ END IF;
+ SELECT memc_set(CONCAT('player_type:',NEW.id), NEW.type) INTO @devnull;
+ SELECT memc_set(CONCAT('player:',NEW.id), NEW.id) INTO @devnull;
+ INSERT INTO profile (player_id) VALUES (NEW.id);
+ INSERT INTO player_last (id,on_pui) VALUES (NEW.id,now());
+ INSERT INTO player_spin (player_id,counter,total,perday,updated_at) values (NEW.id,0,0,memc_get('sysconfig:spins_per_day'),NOW());
+ INSERT INTO player_score (player_id) VALUES (NEW.id);
+ END ;;
+
+DROP TRIGGER IF EXISTS tau_player ;;
CREATE TRIGGER `tau_player` AFTER UPDATE ON `player` FOR EACH ROW
-thisBegin:BEGIN
+ thisBegin:BEGIN
DECLARE ltitle VARCHAR(30) DEFAULT "Joined the platform";
IF (@TRIGGER_CHECKS = FALSE) THEN
LEAVE thisBegin;
@@ -116,56 +223,132 @@ thisBegin:BEGIN
IF NEW.type!=OLD.type THEN
SELECT memc_set(CONCAT('player_type:',NEW.id), NEW.type) INTO @devnull;
END IF;
--- IF (NEW.active!=OLD.active AND NEW.active=1) THEN
--- INSERT INTO stream (player_id,model,model_id,points,title,message,pubtitle,pubmessage,ts) VALUES (NEW.id,'user',NEW.id,0,ltitle,ltitle,ltitle,ltitle,now());
--- END IF;
-END ;;
-
-DROP TRIGGER IF EXISTS `tbd_player` ;;
-CREATE TRIGGER `tbd_player` BEFORE DELETE ON `player` FOR EACH ROW
-thisBegin:BEGIN
- IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
+ IF NEW.status=0 AND OLD.status=10 THEN
+ INSERT INTO archived_stream SELECT * FROM stream WHERE player_id=NEW.id;
+ DELETE FROM stream WHERE player_id=NEW.id;
+ ELSEIF NEW.status=10 AND OLD.status=0 THEN
+ INSERT INTO stream SELECT * FROM archived_stream WHERE player_id=NEW.id;
+ DELETE FROM archived_stream WHERE player_id=NEW.id;
+ ELSEIF NEW.status=10 AND (OLD.status=9 OR OLD.status=8) THEN
+ DELETE FROM player_token WHERE player_id=NEW.id AND `type`='email_verification';
END IF;
+ END ;;
- DELETE FROM player_ssl WHERE player_id=OLD.id;
- DELETE FROM player_rank WHERE player_id=OLD.id;
-END ;;
-
-
-DROP TRIGGER IF EXISTS `tad_player` ;;
+DROP TRIGGER IF EXISTS tbd_player ;;
+CREATE TRIGGER `tbd_player` BEFORE DELETE ON `player` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE tid INT default 0;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ SELECT id INTO tid FROM team where owner_id=OLD.id;
+ IF tid > 0 THEN
+ DELETE FROM team_score WHERE team_id=tid;
+ END IF;
+ DELETE FROM player_ssl WHERE player_id=OLD.id;
+ DELETE FROM player_rank WHERE player_id=OLD.id;
+ END ;;
+
+DROP TRIGGER IF EXISTS tad_player ;;
CREATE TRIGGER `tad_player` AFTER DELETE ON `player` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+
+ IF (select memc_server_count()<1) THEN
+ select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
+ END IF;
+ SELECT memc_delete(CONCAT('player_type:',OLD.id)) INTO @devnull;
+ SELECT memc_delete(CONCAT('player:',OLD.id)) INTO @devnull;
+ SELECT memc_delete(CONCAT('team_player:',OLD.id)) INTO @devnull;
+ DELETE FROM player_score WHERE player_id=OLD.id;
+ DELETE FROM player_score_monthly WHERE player_id=OLD.id;
+ DELETE FROM player_counter_nf WHERE player_id=OLD.id;
+ DELETE FROM profile WHERE player_id=OLD.id;
+ DELETE FROM player_last WHERE id=OLD.id;
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_player_badge ;;
+CREATE TRIGGER `tai_player_badge` AFTER INSERT ON `player_badge` FOR EACH ROW
thisBegin:BEGIN
IF (@TRIGGER_CHECKS = FALSE) THEN
LEAVE thisBegin;
END IF;
- IF (select memc_server_count()<1) THEN
- select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
- END IF;
- SELECT memc_delete(CONCAT('player_type:',OLD.id)) INTO @devnull;
- SELECT memc_delete(CONCAT('player:',OLD.id)) INTO @devnull;
- SELECT memc_delete(CONCAT('team_player:',OLD.id)) INTO @devnull;
- DELETE FROM player_score WHERE player_id=OLD.id;
- DELETE FROM profile WHERE player_id=OLD.id;
- DELETE FROM player_last WHERE id=OLD.id;
+ CALL add_badge_stream(NEW.player_id,'badge',NEW.badge_id);
END ;;
-
-DROP TRIGGER IF EXISTS `tai_player_badge` ;;
-CREATE TRIGGER `tai_player_badge` AFTER INSERT ON `player_badge` FOR EACH ROW
-thisBegin:BEGIN
+DROP TRIGGER IF EXISTS tai_player_disabledroute ;;
+CREATE TRIGGER `tai_player_disabledroute` AFTER INSERT ON `player_disabledroute` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE routes LONGTEXT;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ SET routes:=(SELECT CONCAT('[',GROUP_CONCAT(JSON_OBJECT('player_id',player_id,'route', route) ORDER BY player_id),']') FROM player_disabledroute ORDER BY player_id,route);
+ INSERT INTO sysconfig (id,val) VALUES ('player_disabled_routes',routes) ON DUPLICATE KEY UPDATE val=VALUES(val);
+ END ;;
+
+DROP TRIGGER IF EXISTS tau_player_disabledroute ;;
+CREATE TRIGGER `tau_player_disabledroute` AFTER UPDATE ON `player_disabledroute` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE routes LONGTEXT;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ SET routes:=(SELECT CONCAT('[',GROUP_CONCAT(JSON_OBJECT('player_id',player_id,'route', route) ORDER BY player_id),']') FROM player_disabledroute ORDER BY player_id,route);
+ INSERT INTO sysconfig (id,val) VALUES ('player_disabled_routes',routes) ON DUPLICATE KEY UPDATE val=VALUES(val);
+ END ;;
+
+DROP TRIGGER IF EXISTS tad_player_disabledroute ;;
+CREATE TRIGGER `tad_player_disabledroute` AFTER DELETE ON `player_disabledroute` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE routes LONGTEXT;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ SET routes:=(SELECT CONCAT('[',GROUP_CONCAT(JSON_OBJECT('player_id',player_id, 'route', route) ORDER BY player_id,route),']') FROM player_disabledroute ORDER BY player_id);
+ INSERT INTO sysconfig (id,val) VALUES ('player_disabled_routes',routes) ON DUPLICATE KEY UPDATE val=VALUES(val);
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_player_disconnect_queue ;;
+CREATE TRIGGER `tai_player_disconnect_queue` AFTER INSERT ON `player_disconnect_queue` FOR EACH ROW
+ thisBegin:BEGIN
IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
+ LEAVE thisBegin;
END IF;
+ INSERT INTO player_disconnect_queue_history (player_id,created_at) VALUES (NEW.player_id,NOW());
+ END ;;
- CALL add_badge_stream(NEW.player_id,'badge',NEW.badge_id);
-END ;;
-
-DROP TRIGGER IF EXISTS `tai_player_finding` ;;
+DROP TRIGGER IF EXISTS tad_player_disconnect_queue ;;
+CREATE TRIGGER `tad_player_disconnect_queue` AFTER DELETE ON `player_disconnect_queue` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ INSERT INTO player_disconnect_queue_history (player_id,created_at) VALUES (OLD.player_id,NOW());
+ END ;;
+
+DROP TRIGGER IF EXISTS tbi_player_finding ;;
+CREATE TRIGGER `tbi_player_finding` BEFORE INSERT ON `player_finding` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE local_target_id INT;
+ DECLARE pts FLOAT;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ SELECT target_id,points INTO local_target_id,pts FROM finding WHERE id=NEW.finding_id;
+ SET NEW.points=pts;
+ IF (SELECT count(*) FROM player_target_help WHERE target_id=local_target_id AND player_id=NEW.player_id)>0 THEN
+ SET NEW.points=NEW.points/2;
+ END IF;
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_player_finding ;;
CREATE TRIGGER `tai_player_finding` AFTER INSERT ON `player_finding` FOR EACH ROW
-thisBegin:BEGIN
+ thisBegin:BEGIN
DECLARE local_target_id INT;
DECLARE headshoted INT default null;
DECLARE min_finding,min_treasure,max_finding,max_treasure, max_val, min_val DATETIME;
@@ -178,8 +361,10 @@ thisBegin:BEGIN
select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
END IF;
SELECT memc_set(CONCAT('player_finding:',NEW.player_id, ':', NEW.finding_id),NEW.player_id) INTO @devnull;
- CALL add_finding_stream(NEW.player_id,'finding',NEW.finding_id);
+
+ CALL add_finding_stream(NEW.player_id,'finding',NEW.finding_id,NEW.points);
CALL add_player_finding_hint(NEW.player_id,NEW.finding_id);
+
SET local_target_id=(SELECT target_id FROM finding WHERE id=NEW.finding_id);
SET headshoted=(select true as headshoted FROM target as t left join treasure as t2 on t2.target_id=t.id left join finding as t3 on t3.target_id=t.id LEFT JOIN player_treasure as t4 on t4.treasure_id=t2.id and t4.player_id=NEW.player_id left join player_finding as t5 on t5.finding_id=t3.id and t5.player_id=NEW.player_id WHERE t.id=local_target_id GROUP BY t.id HAVING count(distinct t2.id)=count(distinct t4.treasure_id) AND count(distinct t3.id)=count(distinct t5.finding_id));
IF headshoted IS NOT NULL THEN
@@ -189,93 +374,175 @@ thisBegin:BEGIN
INSERT INTO headshot (player_id,target_id,created_at,timer) VALUES (NEW.player_id,local_target_id,now(),UNIX_TIMESTAMP(max_val)-UNIX_TIMESTAMP(min_val));
INSERT INTO stream (player_id,model,model_id,points,title,message,pubtitle,pubmessage,ts) VALUES (NEW.player_id,'headshot',local_target_id,0,'','','','',now());
END IF;
-END ;;
-
+ INSERT INTO target_player_state (id,player_id,player_findings,player_points,created_at,updated_at) VALUES (local_target_id,NEW.player_id,1,NEW.points,now(),now()) ON DUPLICATE KEY UPDATE player_findings=player_findings+values(player_findings),player_points=player_points+values(player_points),updated_at=now();
+ END ;;
---
--- Keep track of changes on player_last. This is needed in order to be able
--- to troubleshoot and investigate problems
---
-DROP TRIGGER IF EXISTS `tau_player_last` ;;
-CREATE TRIGGER `tau_player_last` AFTER UPDATE ON `player_last` FOR EACH ROW
+DROP TRIGGER IF EXISTS tad_player_finding ;;
+CREATE TRIGGER `tad_player_finding` AFTER DELETE ON `player_finding` FOR EACH ROW
thisBegin:BEGIN
IF (@TRIGGER_CHECKS = FALSE) THEN
LEAVE thisBegin;
END IF;
- IF (OLD.vpn_local_address IS NULL AND NEW.vpn_local_address IS NOT NULL) OR (OLD.vpn_local_address IS NOT NULL AND NEW.vpn_local_address IS NOT NULL AND NEW.vpn_local_address!=OLD.vpn_local_address) THEN
- INSERT INTO `player_vpn_history` (`player_id`,`vpn_local_address`,`vpn_remote_address`) VALUES (NEW.id,NEW.vpn_local_address,NEW.vpn_remote_address);
+ IF (select memc_server_count()<1) THEN
+ select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
END IF;
+ SELECT memc_delete(CONCAT('player_finding:',OLD.player_id, ':', OLD.finding_id)) INTO @devnull;
END ;;
-
---
--- Add a stream notification for the answered question
---
-DROP TRIGGER IF EXISTS `tai_player_question` ;;
+DROP TRIGGER IF EXISTS tau_player_last ;;
+CREATE TRIGGER `tau_player_last` AFTER UPDATE ON `player_last` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+
+ IF (OLD.vpn_local_address IS NULL AND NEW.vpn_local_address IS NOT NULL) THEN
+ DO memc_set(CONCAT('ovpn:',NEW.id),INET_NTOA(NEW.vpn_local_address));
+ DO memc_set(CONCAT('ovpn:',INET_NTOA(NEW.vpn_local_address)),NEW.id);
+ DO memc_set(CONCAT('ovpn_remote:',NEW.id),INET_NTOA(NEW.vpn_remote_address));
+ ELSEIF (OLD.vpn_local_address IS NOT NULL AND NEW.vpn_local_address IS NULL) THEN
+ DO memc_delete(CONCAT('ovpn:',NEW.id));
+ DO memc_delete(CONCAT('ovpn_remote:',NEW.id));
+ DO memc_delete(CONCAT('ovpn:',INET_NTOA(OLD.vpn_local_address)));
+ END IF;
+
+ IF (OLD.vpn_local_address IS NULL AND NEW.vpn_local_address IS NOT NULL) OR (OLD.vpn_local_address IS NOT NULL AND NEW.vpn_local_address IS NOT NULL AND NEW.vpn_local_address!=OLD.vpn_local_address) THEN
+ INSERT INTO `player_vpn_history` (`player_id`,`vpn_local_address`,`vpn_remote_address`) VALUES (NEW.id,NEW.vpn_local_address,NEW.vpn_remote_address);
+ END IF;
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_player_question ;;
CREATE TRIGGER `tai_player_question` AFTER INSERT ON `player_question` FOR EACH ROW
-thisBegin:BEGIN
- IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
- END IF;
- CALL add_stream(NEW.player_id,'question',NEW.question_id);
-END ;;
-
---
--- On any change of the SSL record of the user, update the CRL list with the
--- past values so that we can revoke the old keys
---
-DROP TRIGGER IF EXISTS `tau_player_ssl` ;;
+ thisBegin:BEGIN
+ DECLARE local_challenge_id INT default null;
+ DECLARE completed INT default null;
+ DECLARE min_question,max_question, max_val, min_val DATETIME default null;
+
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+
+ IF (select memc_server_count()<1) THEN
+ select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
+ END IF;
+ CALL add_stream(NEW.player_id,'question',NEW.question_id);
+ SET local_challenge_id=(SELECT challenge_id FROM question WHERE id=NEW.question_id);
+ SET completed=(select true as completed FROM challenge as t left join question as t2 on t2.challenge_id=t.id LEFT JOIN player_question as t4 on t4.question_id=t2.id and t4.player_id=NEW.player_id WHERE t.id=local_challenge_id GROUP BY t.id HAVING count(distinct t2.id)=count(distinct t4.question_id));
+ IF completed IS NOT NULL and completed=true THEN
+ SELECT min(ts),max(ts) INTO min_question,max_question FROM player_question WHERE player_id=NEW.player_id AND question_id IN (SELECT id FROM question WHERE challenge_id=local_challenge_id);
+ SELECT GREATEST(max_question, min_question), LEAST(min_question, max_question) INTO max_val,min_val;
+ INSERT IGNORE INTO challenge_solver (player_id,challenge_id,created_at,timer) VALUES (NEW.player_id,local_challenge_id,now(),UNIX_TIMESTAMP(max_val)-UNIX_TIMESTAMP(min_val));
+ INSERT INTO stream (player_id,model,model_id,points,title,message,pubtitle,pubmessage,ts) VALUES (NEW.player_id,'challenge',local_challenge_id,0,'','','','',now());
+ END IF;
+
+ END ;;
+
+DROP TRIGGER IF EXISTS tau_player_score ;;
+CREATE TRIGGER `tau_player_score` AFTER UPDATE ON `player_score` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+
+ IF NEW.points>=OLD.points THEN
+ INSERT INTO player_score_monthly (player_id, points, dated_at) VALUES (NEW.player_id, ABS(ifnull(OLD.points,0)-NEW.points), EXTRACT(YEAR_MONTH FROM NOW())) ON DUPLICATE KEY UPDATE points=points+values(points);
+ END IF;
+ END ;;
+
+DROP TRIGGER IF EXISTS tau_player_ssl ;;
CREATE TRIGGER `tau_player_ssl` AFTER UPDATE ON `player_ssl` FOR EACH ROW
-thisBegin:BEGIN
- IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
- END IF;
-
- IF OLD.subject!=NEW.subject OR OLD.csr!=NEW.csr OR OLD.crt!=NEW.crt OR OLD.privkey!=NEW.privkey and OLD.subject is not null and OLD.subject!='' THEN
- INSERT INTO `crl` values (NULL,OLD.player_id,OLD.subject,OLD.csr,OLD.crt,OLD.txtcrt,OLD.privkey,NOW());
- END IF;
-END ;;
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ IF OLD.subject!=NEW.subject OR OLD.csr!=NEW.csr OR OLD.crt!=NEW.crt OR OLD.privkey!=NEW.privkey and OLD.subject is not null and OLD.subject!='' THEN
+ INSERT INTO `crl` values (NULL,OLD.player_id,OLD.subject,OLD.csr,OLD.crt,OLD.privkey,NOW());
+ END IF;
+ END ;;
-DROP TRIGGER IF EXISTS `tad_player_ssl` ;;
+DROP TRIGGER IF EXISTS tad_player_ssl ;;
CREATE TRIGGER `tad_player_ssl` AFTER DELETE ON `player_ssl` FOR EACH ROW
-thisBegin:BEGIN
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ INSERT INTO `crl` values (NULL,OLD.player_id,OLD.subject,OLD.csr,OLD.crt,OLD.privkey,NOW());
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_player_token ;;
+CREATE TRIGGER `tai_player_token` AFTER INSERT ON `player_token` FOR EACH ROW
+ thisBegin:BEGIN
IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
+ LEAVE thisBegin;
END IF;
- INSERT INTO `crl` values (NULL,OLD.player_id,OLD.subject,OLD.csr,OLD.crt,OLD.txtcrt,OLD.privkey,NOW());
-END ;;
-
-
-DROP TRIGGER IF EXISTS `tai_player_treasure` ;;
-CREATE TRIGGER `tai_player_treasure` AFTER INSERT ON `player_treasure` FOR EACH ROW
-thisBegin:BEGIN
- DECLARE local_target_id INT;
- DECLARE headshoted INT default null;
- DECLARE min_finding,min_treasure,max_finding,max_treasure, max_val, min_val DATETIME;
+ INSERT INTO player_token_history (player_id,`type`,token,`description`,expires_at,created_at,ts) VALUES (NEW.player_id,NEW.type,NEW.token,NEW.description,NEW.expires_at,NEW.created_at,NOW());
+ END ;;
+DROP TRIGGER IF EXISTS tau_player_token ;;
+CREATE TRIGGER `tau_player_token` AFTER UPDATE ON `player_token` FOR EACH ROW
+ thisBegin:BEGIN
IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
+ LEAVE thisBegin;
END IF;
-
- CALL add_treasure_stream(NEW.player_id,'treasure',NEW.treasure_id);
- CALL add_player_treasure_hint(NEW.player_id,NEW.treasure_id);
-
- SET local_target_id=(SELECT target_id FROM treasure WHERE id=NEW.treasure_id);
- SET headshoted=(select true as headshoted FROM target as t left join treasure as t2 on t2.target_id=t.id left join finding as t3 on t3.target_id=t.id LEFT JOIN player_treasure as t4 on t4.treasure_id=t2.id and t4.player_id=NEW.player_id left join player_finding as t5 on t5.finding_id=t3.id and t5.player_id=NEW.player_id WHERE t.id=local_target_id GROUP BY t.id HAVING count(distinct t2.id)=count(distinct t4.treasure_id) AND count(distinct t3.id)=count(distinct t5.finding_id));
-
- IF headshoted IS NOT NULL THEN
- SELECT min(ts),max(ts) INTO min_finding,max_finding FROM player_finding WHERE player_id=NEW.player_id AND finding_id IN (SELECT id FROM finding WHERE target_id=local_target_id);
- SELECT min(ts),max(ts) INTO min_treasure,max_treasure FROM player_treasure WHERE player_id=NEW.player_id AND treasure_id IN (SELECT id FROM treasure WHERE target_id=local_target_id);
- SELECT GREATEST(max_finding, max_treasure), LEAST(min_finding, min_treasure) INTO max_val,min_val;
- INSERT INTO headshot (player_id,target_id,created_at,timer) VALUES (NEW.player_id,local_target_id,now(),UNIX_TIMESTAMP(max_val)-UNIX_TIMESTAMP(min_val));
- INSERT INTO stream (player_id,model,model_id,points,title,message,pubtitle,pubmessage,ts) VALUES (NEW.player_id,'headshot',local_target_id,0,'','','','',now());
+ IF (NEW.token != OLD.token) THEN
+ INSERT INTO player_token_history (player_id,`type`,token,description,expires_at,created_at,ts) VALUES (NEW.player_id,NEW.type,NEW.token,NEW.description,NEW.expires_at,NEW.created_at,NOW());
END IF;
-END ;;
+ END ;;
-
-DROP TRIGGER IF EXISTS `tbi_profile` ;;
+DROP TRIGGER IF EXISTS tad_player_token ;;
+CREATE TRIGGER `tad_player_token` AFTER DELETE ON `player_token` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ INSERT INTO player_token_history (player_id,`type`,token,description,expires_at,created_at,ts) VALUES (OLD.player_id,OLD.type,OLD.token,OLD.description,OLD.expires_at,OLD.created_at,NOW());
+ END ;;
+
+DROP TRIGGER IF EXISTS tbi_player_treasure ;;
+CREATE TRIGGER `tbi_player_treasure` BEFORE INSERT ON `player_treasure` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE local_target_id INT;
+ DECLARE pts FLOAT;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ SELECT target_id,points INTO local_target_id,pts FROM treasure WHERE id=NEW.treasure_id;
+ SET NEW.points=pts;
+ IF (SELECT count(*) FROM player_target_help WHERE target_id=local_target_id AND player_id=NEW.player_id)>0 THEN
+ SET NEW.points=NEW.points/2;
+ END IF;
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_player_treasure ;;
+CREATE TRIGGER `tai_player_treasure` AFTER INSERT ON `player_treasure` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE local_target_id INT;
+ DECLARE headshoted INT default null;
+ DECLARE min_finding,min_treasure,max_finding,max_treasure, max_val, min_val DATETIME;
+
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+
+ CALL add_treasure_stream(NEW.player_id,'treasure',NEW.treasure_id,NEW.points);
+ CALL add_player_treasure_hint(NEW.player_id,NEW.treasure_id);
+
+ SET local_target_id=(SELECT target_id FROM treasure WHERE id=NEW.treasure_id);
+ SET headshoted=(select true as headshoted FROM target as t left join treasure as t2 on t2.target_id=t.id left join finding as t3 on t3.target_id=t.id LEFT JOIN player_treasure as t4 on t4.treasure_id=t2.id and t4.player_id=NEW.player_id left join player_finding as t5 on t5.finding_id=t3.id and t5.player_id=NEW.player_id WHERE t.id=local_target_id GROUP BY t.id HAVING count(distinct t2.id)=count(distinct t4.treasure_id) AND count(distinct t3.id)=count(distinct t5.finding_id));
+
+ IF headshoted IS NOT NULL THEN
+ SELECT min(ts),max(ts) INTO min_finding,max_finding FROM player_finding WHERE player_id=NEW.player_id AND finding_id IN (SELECT id FROM finding WHERE target_id=local_target_id);
+ SELECT min(ts),max(ts) INTO min_treasure,max_treasure FROM player_treasure WHERE player_id=NEW.player_id AND treasure_id IN (SELECT id FROM treasure WHERE target_id=local_target_id);
+ SELECT GREATEST(max_finding, max_treasure), LEAST(min_finding, min_treasure) INTO max_val,min_val;
+ INSERT INTO headshot (player_id,target_id,created_at,timer) VALUES (NEW.player_id,local_target_id,now(),UNIX_TIMESTAMP(max_val)-UNIX_TIMESTAMP(min_val));
+ INSERT INTO stream (player_id,model,model_id,points,title,message,pubtitle,pubmessage,ts) VALUES (NEW.player_id,'headshot',local_target_id,0,'','','','',now());
+ END IF;
+ INSERT INTO target_player_state (id,player_id,player_treasures,player_points,created_at,updated_at) VALUES (local_target_id,NEW.player_id,1,NEW.points,now(),now()) ON DUPLICATE KEY UPDATE player_treasures=player_treasures+values(player_treasures),player_points=player_points+values(player_points),updated_at=now();
+ END ;;
+
+DROP TRIGGER IF EXISTS tbi_profile ;;
CREATE TRIGGER `tbi_profile` BEFORE INSERT ON `profile` FOR EACH ROW
thisBegin:BEGIN
IF (@TRIGGER_CHECKS = FALSE) THEN
@@ -297,34 +564,8 @@ thisBegin:BEGIN
END IF;
END ;;
-
-
-DROP TRIGGER IF EXISTS `tad_spin_queue` ;;
-CREATE TRIGGER `tad_spin_queue` AFTER DELETE ON `spin_queue` FOR EACH ROW
-thisBegin:BEGIN
- IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
- END IF;
- INSERT INTO `spin_history` (target_id,player_id,created_at,updated_at) VALUES (OLD.target_id,OLD.player_id,OLD.created_at,NOW());
-END ;;
-
--- XXXFIXMEXXX This needs to be optimised with an UPDATE instead of INSERT and
--- only when points>0
-DROP TRIGGER IF EXISTS `tai_stream` ;;
-CREATE TRIGGER `tai_stream` AFTER INSERT ON stream FOR EACH ROW
-thisBegin:BEGIN
- IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
- END IF;
-
- INSERT INTO player_score (player_id,points) VALUES (NEW.player_id,NEW.points) ON DUPLICATE KEY UPDATE points=points+values(points);
- IF (SELECT count(team_id) FROM team_player WHERE player_id=NEW.player_id)>0 THEN
- INSERT INTO team_score (team_id,points) VALUES ((SELECT team_id FROM team_player WHERE player_id=NEW.player_id),NEW.points) ON DUPLICATE KEY UPDATE points=points+values(points);
- END IF;
-END ;;
-
-DROP TRIGGER IF EXISTS `tai_sysconfig` ;;
-CREATE TRIGGER `tai_sysconfig` AFTER INSERT ON `sysconfig` FOR EACH ROW
+DROP TRIGGER IF EXISTS tad_sessions ;;
+CREATE TRIGGER `tad_sessions` AFTER DELETE ON `sessions` FOR EACH ROW
thisBegin:BEGIN
IF (@TRIGGER_CHECKS = FALSE) THEN
LEAVE thisBegin;
@@ -333,96 +574,385 @@ thisBegin:BEGIN
IF (select memc_server_count()<1) THEN
select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
END IF;
- SELECT memc_set(CONCAT('sysconfig:',NEW.id),NEW.val) INTO @devnull;
-END ;;
-
-DROP TRIGGER IF EXISTS `tau_sysconfig` ;;
-CREATE TRIGGER `tau_sysconfig` AFTER UPDATE ON `sysconfig` FOR EACH ROW
-thisBegin:BEGIN
- IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
- END IF;
- IF (select memc_server_count()<1) THEN
- select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
- END IF;
- IF NEW.id != OLD.id THEN
- SELECT memc_delete(CONCAT('sysconfig:',OLD.id)) INTO @devnull;
- END IF;
- SELECT memc_set(CONCAT('sysconfig:',NEW.id),NEW.val) INTO @devnull;
+ SELECT memc_delete(CONCAT('memc.sess.',OLD.id)) INTO @devnull;
+ SELECT memc_delete(CONCAT('player_session:',OLD.player_id)) INTO @devnull;
END ;;
-
-DROP TRIGGER IF EXISTS `tad_sysconfig` ;;
-CREATE TRIGGER `tad_sysconfig` AFTER DELETE ON `sysconfig` FOR EACH ROW
+DROP TRIGGER IF EXISTS tad_spin_queue ;;
+CREATE TRIGGER `tad_spin_queue` AFTER DELETE ON `spin_queue` FOR EACH ROW
thisBegin:BEGIN
IF (@TRIGGER_CHECKS = FALSE) THEN
LEAVE thisBegin;
END IF;
-
- IF (select memc_server_count()<1) THEN
- select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
- END IF;
- SELECT memc_delete(CONCAT('sysconfig:',OLD.id)) INTO @devnull;
+ INSERT INTO `spin_history` (target_id,player_id,created_at,updated_at) VALUES (OLD.target_id,OLD.player_id,OLD.created_at,NOW());
END ;;
--- XXXFIXMEXXX ONLY UPDATE ACTIVE TARGETS
-DROP TRIGGER IF EXISTS `tai_target` ;;
+DROP TRIGGER IF EXISTS tai_stream ;;
+CREATE TRIGGER `tai_stream` AFTER INSERT ON `stream` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE lteam_id INT;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ IF NEW.points>0 THEN
+ INSERT INTO player_score (player_id,points) VALUES (NEW.player_id,NEW.points) ON DUPLICATE KEY UPDATE points=points+values(points);
+ END IF;
+ SELECT team_id INTO lteam_id FROM team_player WHERE player_id=NEW.player_id AND approved=1;
+ IF lteam_id IS NOT NULL THEN
+ INSERT IGNORE INTO team_stream (team_id,model,model_id,points,ts) VALUES (lteam_id,NEW.model,NEW.model_id,NEW.points,NEW.ts);
+ END IF;
+ END ;;
+
+DROP TRIGGER IF EXISTS tad_stream ;;
+CREATE TRIGGER `tad_stream` AFTER DELETE ON `stream` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ INSERT INTO player_score (player_id,points) VALUES (OLD.player_id,-OLD.points) ON DUPLICATE KEY UPDATE points=if(points+values(points)<0,0,points+values(points));
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_sysconfig ;;
+CREATE TRIGGER `tai_sysconfig` AFTER INSERT ON `sysconfig` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+
+ IF (select memc_server_count()<1) THEN
+ select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
+ END IF;
+ DO memc_set('sysconfig_json',(SELECT CONCAT('[',GROUP_CONCAT(JSON_OBJECT('id', id,'val',val) ORDER BY id),']') FROM sysconfig WHERE id NOT LIKE 'CA%' and id NOT IN ('disabled_routes','frontpage_scenario','routes','writeup_rules','vpn-ta.key') ORDER BY id));
+ DO memc_set(CONCAT('sysconfig:',NEW.id),NEW.val);
+ END ;;
+
+DROP TRIGGER IF EXISTS tau_sysconfig ;;
+CREATE TRIGGER `tau_sysconfig` AFTER UPDATE ON `sysconfig` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ IF (select memc_server_count()<1) THEN
+ select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
+ END IF;
+ IF NEW.id != OLD.id THEN
+ SELECT memc_delete(CONCAT('sysconfig:',OLD.id)) INTO @devnull;
+ END IF;
+ DO memc_set('sysconfig_json',(SELECT CONCAT('[',GROUP_CONCAT(JSON_OBJECT('id', id,'val',val) ORDER BY id),']') FROM sysconfig WHERE id NOT LIKE 'CA%' and id NOT IN ('disabled_routes','frontpage_scenario','routes','writeup_rules','vpn-ta.key') ORDER BY id));
+ DO memc_set(CONCAT('sysconfig:',NEW.id),NEW.val);
+ END ;;
+
+DROP TRIGGER IF EXISTS tad_sysconfig ;;
+CREATE TRIGGER `tad_sysconfig` AFTER DELETE ON `sysconfig` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+
+ IF (select memc_server_count()<1) THEN
+ select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
+ END IF;
+ DO memc_set('sysconfig_json',(SELECT CONCAT('[',GROUP_CONCAT(JSON_OBJECT('id', id,'val',val) ORDER BY id),']') FROM sysconfig WHERE id NOT LIKE 'CA%' and id NOT IN ('disabled_routes','frontpage_scenario','routes','writeup_rules','vpn-ta.key') ORDER BY id));
+ DO memc_delete(CONCAT('sysconfig:',OLD.id));
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_target ;;
CREATE TRIGGER `tai_target` AFTER INSERT ON `target` FOR EACH ROW
-thisBegin:BEGIN
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+
+ IF (select memc_server_count()<1) THEN
+ DO memc_servers_set('127.0.0.1');
+ END IF;
+ INSERT IGNORE INTO target_state (id) values (NEW.id);
+ DO memc_set(CONCAT('target:',NEW.id),NEW.ip);
+ DO memc_set(CONCAT('target:',NEW.ip),NEW.id);
+ END ;;
+
+DROP TRIGGER IF EXISTS tbd_target ;;
+CREATE TRIGGER `tbd_target` BEFORE DELETE ON `target` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ DELETE FROM headshot WHERE target_id=OLD.id;
+ DELETE FROM finding WHERE target_id=OLD.id;
+ DELETE FROM treasure WHERE target_id=OLD.id;
+ DELETE FROM target_state WHERE id=OLD.id;
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_target_instance ;;
+CREATE TRIGGER `tai_target_instance` AFTER INSERT ON `target_instance` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ IF NEW.ip IS NOT NULL THEN
+ DO memc_set(CONCAT('target:',NEW.ip),NEW.target_id);
+ END IF;
+ INSERT DELAYED INTO `target_instance_audit` (op,player_id,target_id,server_id,ip,reboot,team_allowed,ts) VALUES ('i',NEW.player_id,NEW.target_id,NEW.server_id,NEW.ip,NEW.reboot,NEW.team_allowed,NOW());
+ END ;;
+
+DROP TRIGGER IF EXISTS tau_target_instance ;;
+CREATE TRIGGER `tau_target_instance` AFTER UPDATE ON `target_instance` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ IF NEW.ip IS NOT NULL AND OLD.ip IS NULL THEN
+ DO memc_set(CONCAT('target:',NEW.ip),NEW.target_id);
+ INSERT DELAYED INTO `target_instance_audit` (op,player_id,target_id,server_id,ip,reboot,team_allowed,ts) VALUES ('u',NEW.player_id,NEW.target_id,NEW.server_id,NEW.ip,NEW.reboot,NEW.team_allowed,NOW());
+ ELSEIF (NEW.ip IS NULL OR NEW.ip = '') and OLD.ip IS NOT NULL THEN
+ DO memc_delete(CONCAT('target:',OLD.ip));
+ INSERT DELAYED INTO `target_instance_audit` (op,player_id,target_id,server_id,ip,reboot,team_allowed,ts) VALUES ('u',NEW.player_id,NEW.target_id,NEW.server_id,NEW.ip,NEW.reboot,NEW.team_allowed,NOW());
+ ELSEIF NEW.ip!=OLD.ip THEN
+ DO memc_delete(CONCAT('target:',OLD.ip));
+ DO memc_set(CONCAT('target:',NEW.ip),NEW.target_id);
+ INSERT DELAYED INTO `target_instance_audit` (op,player_id,target_id,server_id,ip,reboot,team_allowed,ts) VALUES ('u',NEW.player_id,NEW.target_id,NEW.server_id,NEW.ip,NEW.reboot,NEW.team_allowed,NOW());
+ END IF;
+ END ;;
+
+DROP TRIGGER IF EXISTS tad_target_instance ;;
+CREATE TRIGGER `tad_target_instance` AFTER DELETE ON `target_instance` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ IF OLD.ip IS NOT NULL THEN
+ DO memc_delete(CONCAT('target:',OLD.ip));
+ END IF;
+ INSERT DELAYED INTO `target_instance_audit` (op,player_id,target_id,server_id,ip,reboot,team_allowed,ts) VALUES ('d',OLD.player_id,OLD.target_id,OLD.server_id,OLD.ip,OLD.reboot,OLD.team_allowed,NOW());
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_target_ondemand ;;
+CREATE TRIGGER `tai_target_ondemand` AFTER INSERT ON `target_ondemand` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ UPDATE target_state SET on_ondemand=1,ondemand_state=NEW.state WHERE id=NEW.target_id;
+ END ;;
+
+DROP TRIGGER IF EXISTS tau_target_ondemand ;;
+CREATE TRIGGER `tau_target_ondemand` AFTER UPDATE ON `target_ondemand` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+
+ UPDATE target_state SET ondemand_state=NEW.state WHERE id=NEW.target_id;
+
+ END ;;
+
+DROP TRIGGER IF EXISTS tad_target_ondemand ;;
+CREATE TRIGGER `tad_target_ondemand` AFTER DELETE ON `target_ondemand` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ UPDATE target_state SET on_ondemand=0,ondemand_state=-1 WHERE id=OLD.target_id;
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_team ;;
+CREATE TRIGGER `tai_team` AFTER INSERT ON `team` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ INSERT INTO team_audit (team_id,player_id,`action`,`message`) VALUES (NEW.id,NEW.owner_id,'create',CONCAT('Team ',NEW.name,' created'));
+ END ;;
+
+DROP TRIGGER IF EXISTS tau_team ;;
+CREATE TRIGGER `tau_team` AFTER UPDATE ON `team` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE msg TEXT;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ SET msg = 'Team details updated:';
+ IF OLD.name != NEW.name THEN
+ SET msg = CONCAT(msg,' name=',NEW.name);
+ END IF;
+
+ IF OLD.recruitment IS NOT NULL OR OLD.recruitment != NEW.recruitment THEN
+ SET msg = CONCAT(msg,' recruitment=',NEW.recruitment);
+ END IF;
+
+ IF OLD.description != NEW.description THEN
+ SET msg = CONCAT(msg,' description=',NEW.description);
+ END IF;
+
+ IF OLD.inviteonly != NEW.inviteonly THEN
+ SET msg = CONCAT(msg,' inviteonly=',NEW.inviteonly);
+ END IF;
+
+ IF OLD.token != NEW.token THEN
+ SET msg = CONCAT(msg,' token=',NEW.token);
+ END IF;
+
+ INSERT INTO team_audit (team_id,player_id,`action`,`message`) VALUES (NEW.id,NEW.owner_id,'update',msg);
+ END ;;
+
+DROP TRIGGER IF EXISTS tad_team ;;
+CREATE TRIGGER `tad_team` AFTER DELETE ON `team` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ DELETE FROM `team_stream` WHERE team_id=OLD.id;
+ DELETE FROM `team_rank` WHERE team_id=OLD.id;
+ DELETE FROM `team_score` WHERE team_id=OLD.id;
+ INSERT INTO team_audit (team_id,player_id,`action`,`message`) VALUES (OLD.id,OLD.owner_id,'delete',CONCAT('Team ',OLD.name,' deleted'));
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_team_player ;;
+CREATE TRIGGER `tai_team_player` AFTER INSERT ON `team_player` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ INSERT INTO team_audit (team_id,player_id,`action`,`message`) VALUES (NEW.team_id,NEW.player_id,'join','Player joined the team');
+ END ;;
+
+DROP TRIGGER IF EXISTS tau_team_player ;;
+CREATE TRIGGER `tau_team_player` AFTER UPDATE ON `team_player` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ IF OLD.approved != NEW.approved THEN
+ IF NEW.approved = 0 THEN
+ INSERT INTO team_audit (team_id,player_id,`action`,`message`) VALUES (NEW.team_id,NEW.player_id,'reject','Player membership rejected');
+ ELSE
+ INSERT INTO team_audit (team_id,player_id,`action`,`message`) VALUES (NEW.team_id,NEW.player_id,'approve','Player membership approved');
+ END IF;
+ END IF;
+ END ;;
+
+DROP TRIGGER IF EXISTS tad_team_player ;;
+CREATE TRIGGER `tad_team_player` AFTER DELETE ON `team_player` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ INSERT INTO team_audit (team_id,player_id,`action`,`message`) VALUES (OLD.team_id,OLD.player_id,'withdraw','Player removed from the team');
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_team_stream ;;
+CREATE TRIGGER `tai_team_stream` AFTER INSERT ON `team_stream` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ INSERT INTO `team_score` (`team_id`,`points`,`ts`) VALUES (NEW.team_id,NEW.points,NEW.ts) ON DUPLICATE KEY UPDATE points=points+values(points),ts=values(ts);
+ END ;;
+
+DROP TRIGGER IF EXISTS tad_team_stream ;;
+CREATE TRIGGER `tad_team_stream` AFTER DELETE ON `team_stream` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ INSERT INTO `team_score` (`team_id`,`points`,`ts`) VALUES (OLD.team_id,-OLD.points,OLD.ts) ON DUPLICATE KEY UPDATE points=if(points+values(points)<0,0,points+values(points)),ts=values(ts);
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_treasure ;;
+CREATE TRIGGER `tai_treasure` AFTER INSERT ON `treasure` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ UPDATE target_state SET total_treasures=total_treasures+1,total_points=total_points+ifnull(NEW.points,0),treasure_points=treasure_points+ifnull(NEW.points,0) WHERE id=NEW.target_id;
+ END ;;
+
+DROP TRIGGER IF EXISTS tad_treasure ;;
+CREATE TRIGGER `tad_treasure` AFTER DELETE ON `treasure` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ UPDATE target_state SET total_treasures=total_treasures-1,total_points=total_points-IFNULL(OLD.points,0),treasure_points=treasure_points-IFNULL(OLD.points,0) WHERE id=OLD.target_id;
+ DELETE FROM stream WHERE model_id=OLD.id and model='treasure';
+ DELETE FROM team_stream WHERE model_id=OLD.id and model='treasure';
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_url_route ;;
+CREATE TRIGGER `tai_url_route` AFTER INSERT ON `url_route` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE routes LONGTEXT;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ SET routes:=(SELECT CONCAT('[',GROUP_CONCAT(JSON_OBJECT('source', source, 'destination', destination) ORDER BY weight,source,destination),']') FROM url_route ORDER BY weight, source, destination);
+ INSERT INTO sysconfig (id,val) VALUES ('routes',routes) ON DUPLICATE KEY UPDATE val=VALUES(val);
+ END ;;
+
+DROP TRIGGER IF EXISTS tau_url_route ;;
+CREATE TRIGGER `tau_url_route` AFTER UPDATE ON `url_route` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE routes LONGTEXT;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ SET routes:=(SELECT CONCAT('[',GROUP_CONCAT(JSON_OBJECT('source', source, 'destination', destination) ORDER BY weight,source,destination),']') FROM url_route ORDER BY weight, source, destination);
+ INSERT INTO sysconfig (id,val) VALUES ('routes',routes) ON DUPLICATE KEY UPDATE val=VALUES(val);
+ END ;;
+
+DROP TRIGGER IF EXISTS tad_url_route ;;
+CREATE TRIGGER `tad_url_route` AFTER DELETE ON `url_route` FOR EACH ROW
+ thisBegin:BEGIN
+ DECLARE routes LONGTEXT;
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
+ SET routes:=(SELECT CONCAT('[',GROUP_CONCAT(JSON_OBJECT('source', source, 'destination', destination) ORDER BY weight,source,destination),']') FROM url_route ORDER BY weight, source, destination);
+ INSERT INTO sysconfig (id,val) VALUES ('routes',routes) ON DUPLICATE KEY UPDATE val=VALUES(val);
+ END ;;
+
+DROP TRIGGER IF EXISTS tai_writeup ;;
+CREATE TRIGGER `tai_writeup` AFTER INSERT ON `writeup` FOR EACH ROW
+ thisBegin:BEGIN
IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
- END IF;
-
- IF (select memc_server_count()<1) THEN
- select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
+ LEAVE thisBegin;
END IF;
- SELECT memc_set(CONCAT('target:',NEW.id),NEW.ip) INTO @devnull;
- SELECT memc_set(CONCAT('target:',NEW.ip),NEW.id) INTO @devnull;
-END ;;
+ UPDATE target_state SET total_writeups=total_writeups+1, approved_writeups=approved_writeups+IF(NEW.approved>0,1,0) WHERE id=NEW.target_id;
+ END ;;
--- Schedule spin of target when it gets headshoted
-DROP TRIGGER IF EXISTS `tai_headshot` ;;
-CREATE TRIGGER `tai_headshot` AFTER INSERT ON `headshot` FOR EACH ROW
-thisBegin:BEGIN
- IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
- END IF;
- INSERT IGNORE INTO spin_queue (target_id, player_id,created_at) VALUES (NEW.target_id,NEW.player_id,NOW());
-END ;;
+DROP TRIGGER IF EXISTS tau_writeup ;;
+CREATE TRIGGER `tau_writeup` AFTER UPDATE ON `writeup` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
-DROP TRIGGER IF EXISTS `tad_player_finding` ;;
-CREATE TRIGGER `tad_player_finding` AFTER DELETE ON `player_finding` FOR EACH ROW
-thisBegin:BEGIN
- IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
- END IF;
+ IF NEW.approved=1 and OLD.approved=0 THEN
+ UPDATE target_state SET approved_writeups=approved_writeups+1 WHERE id=NEW.target_id;
+ ELSEIF NEW.approved=0 and OLD.approved=1 THEN
+ UPDATE target_state SET approved_writeups=approved_writeups-1 WHERE id=NEW.target_id;
+ END IF;
- IF (select memc_server_count()<1) THEN
- select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
- END IF;
- SELECT memc_delete(CONCAT('player_finding:',OLD.player_id, ':', OLD.finding_id)) INTO @devnull;
-END ;;
+ END ;;
+DROP TRIGGER IF EXISTS tad_writeup ;;
+CREATE TRIGGER `tad_writeup` AFTER DELETE ON `writeup` FOR EACH ROW
+ thisBegin:BEGIN
+ IF (@TRIGGER_CHECKS = FALSE) THEN
+ LEAVE thisBegin;
+ END IF;
-DROP TRIGGER IF EXISTS `tad_sessions` ;;
-CREATE TRIGGER `tad_sessions` AFTER DELETE ON `sessions` FOR EACH ROW
-thisBegin:BEGIN
- IF (@TRIGGER_CHECKS = FALSE) THEN
- LEAVE thisBegin;
- END IF;
+ IF OLD.approved=1 THEN
+ UPDATE target_state SET approved_writeups=approved_writeups-1,total_writeups=total_writeups-1 WHERE id=OLD.target_id;
+ ELSEIF OLD.approved=0 THEN
+ UPDATE target_state SET total_writeups=total_writeups-1 WHERE id=OLD.target_id;
+ END IF;
- IF (select memc_server_count()<1) THEN
- select memc_servers_set('127.0.0.1') INTO @memc_server_set_status;
- END IF;
+ END ;;
- SELECT memc_delete(CONCAT('memc.sess.',OLD.id)) INTO @devnull;
- SELECT memc_delete(CONCAT('player_session:',OLD.player_id)) INTO @devnull;
-END ;;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
diff --git a/schemas/echoCTF.sql b/schemas/echoCTF.sql
old mode 100755
new mode 100644
index bd961028c..f16a885ea
--- a/schemas/echoCTF.sql
+++ b/schemas/echoCTF.sql
@@ -1,7 +1,5 @@
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8mb4 */;
+SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
+ALTER DATABASE `echoCTF` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
@@ -14,233 +12,291 @@
--
DROP TABLE IF EXISTS `achievement`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `achievement` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `pubname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Name for the public eyes',
- `description` text COLLATE utf8mb4_unicode_ci,
- `pubdescription` text COLLATE utf8mb4_unicode_ci COMMENT 'Description for the public eyes',
+ `name` varchar(255) DEFAULT NULL,
+ `pubname` varchar(255) DEFAULT NULL COMMENT 'Name for the public eyes',
+ `description` mediumtext DEFAULT NULL,
+ `pubdescription` mediumtext DEFAULT NULL COMMENT 'Description for the public eyes',
`points` decimal(10,2) DEFAULT NULL,
- `player_type` enum('offense','defense') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'offense',
- `appears` int(11) DEFAULT '0',
- `effects` enum('users_id','team','total') COLLATE utf8mb4_unicode_ci DEFAULT 'users_id',
- `code` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `player_type` enum('offense','defense') NOT NULL DEFAULT 'offense',
+ `appears` int(11) DEFAULT 0,
+ `effects` enum('users_id','team','total') DEFAULT 'users_id',
+ `code` varchar(128) DEFAULT NULL,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `archived_stream`
+--
+
+DROP TABLE IF EXISTS `archived_stream`;
+CREATE TABLE `archived_stream` (
+ `id` bigint(20) unsigned NOT NULL DEFAULT 0,
+ `player_id` int(10) unsigned DEFAULT NULL,
+ `model` varchar(255) DEFAULT NULL,
+ `model_id` int(11) DEFAULT NULL,
+ `points` int(11) DEFAULT 0,
+ `title` varchar(255) NOT NULL,
+ `message` mediumtext DEFAULT NULL,
+ `pubtitle` varchar(255) NOT NULL,
+ `pubmessage` mediumtext DEFAULT NULL,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp()
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `avatar`
--
DROP TABLE IF EXISTS `avatar`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `avatar` (
- `id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
+ `id` varchar(32) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `badge`
--
DROP TABLE IF EXISTS `badge`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `badge` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `pubname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Name for the public eyes',
- `description` text COLLATE utf8mb4_unicode_ci,
- `pubdescription` text COLLATE utf8mb4_unicode_ci COMMENT 'Description for the public eyes',
+ `name` varchar(255) DEFAULT NULL,
+ `pubname` varchar(255) DEFAULT NULL COMMENT 'Name for the public eyes',
+ `description` mediumtext DEFAULT NULL,
+ `pubdescription` mediumtext DEFAULT NULL COMMENT 'Description for the public eyes',
`points` decimal(10,2) DEFAULT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Badges are given to the users based on gathering certain other achievements, treasures and findings';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `badge_finding`
--
DROP TABLE IF EXISTS `badge_finding`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `badge_finding` (
- `badge_id` int(11) NOT NULL DEFAULT '0',
- `finding_id` int(11) NOT NULL DEFAULT '0',
+ `badge_id` int(11) NOT NULL DEFAULT 0,
+ `finding_id` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`badge_id`,`finding_id`),
KEY `finding_id` (`finding_id`),
CONSTRAINT `badge_finding_ibfk_1` FOREIGN KEY (`badge_id`) REFERENCES `badge` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `badge_finding_ibfk_2` FOREIGN KEY (`finding_id`) REFERENCES `finding` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='What treasures are needed to get this badge';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `badge_treasure`
--
DROP TABLE IF EXISTS `badge_treasure`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `badge_treasure` (
- `badge_id` int(11) NOT NULL DEFAULT '0',
- `treasure_id` int(11) NOT NULL DEFAULT '0',
+ `badge_id` int(11) NOT NULL DEFAULT 0,
+ `treasure_id` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`badge_id`,`treasure_id`),
KEY `treasure_id` (`treasure_id`),
CONSTRAINT `badge_treasure_ibfk_1` FOREIGN KEY (`badge_id`) REFERENCES `badge` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `badge_treasure_ibfk_2` FOREIGN KEY (`treasure_id`) REFERENCES `treasure` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='What treasures are needed to get this badge';
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `banned_mx_server`
+--
+
+DROP TABLE IF EXISTS `banned_mx_server`;
+CREATE TABLE `banned_mx_server` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) DEFAULT NULL,
+ `notes` mediumtext DEFAULT NULL,
+ `created_at` datetime DEFAULT NULL,
+ `updated_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `banned_player`
--
DROP TABLE IF EXISTS `banned_player`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `banned_player` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`old_id` int(11) DEFAULT NULL,
- `username` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `email` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `username` varchar(32) DEFAULT NULL,
+ `email` varchar(128) DEFAULT NULL,
`registered_at` datetime DEFAULT NULL,
`banned_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `challenge`
--
DROP TABLE IF EXISTS `challenge`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `challenge` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `category` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '',
- `difficulty` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT 'moderate',
- `description` longtext COLLATE utf8mb4_unicode_ci,
- `player_type` enum('offense','defense') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'offense',
- `filename` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'The filename that will be provided to participants',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `name` varchar(255) DEFAULT NULL,
+ `category` varchar(255) DEFAULT '',
+ `difficulty` varchar(255) DEFAULT 'moderate',
+ `description` longtext DEFAULT NULL,
+ `player_type` enum('offense','defense') NOT NULL DEFAULT 'offense',
+ `filename` varchar(255) DEFAULT NULL COMMENT 'The filename that will be provided to participants',
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `active` tinyint(1) DEFAULT 1,
+ `icon` varchar(255) DEFAULT NULL,
+ `timer` tinyint(1) DEFAULT 1,
+ `public` tinyint(1) NOT NULL DEFAULT 1,
PRIMARY KEY (`id`),
- UNIQUE KEY `name` (`name`)
+ UNIQUE KEY `name` (`name`),
+ KEY `idx-challenge-public` (`public`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `challenge_solver`
+--
+
+DROP TABLE IF EXISTS `challenge_solver`;
+CREATE TABLE `challenge_solver` (
+ `challenge_id` int(11) NOT NULL,
+ `player_id` int(11) unsigned NOT NULL,
+ `timer` bigint(20) DEFAULT NULL,
+ `rating` smallint(6) NOT NULL DEFAULT -1,
+ `created_at` datetime DEFAULT NULL,
+ `first` tinyint(1) DEFAULT 0,
+ PRIMARY KEY (`challenge_id`,`player_id`),
+ KEY `idx-challenge_solver-challenge_id` (`challenge_id`),
+ KEY `idx-challenge_solver-player_id` (`player_id`),
+ CONSTRAINT `fk-challenge_solver-challenge_id` FOREIGN KEY (`challenge_id`) REFERENCES `challenge` (`id`) ON DELETE CASCADE,
+ CONSTRAINT `fk-challenge_solver-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `country`
--
DROP TABLE IF EXISTS `country`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `country` (
- `id` varchar(12) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
- `name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `id` varchar(12) NOT NULL DEFAULT '',
+ `name` varchar(64) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `credential`
--
DROP TABLE IF EXISTS `credential`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `credential` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `service` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
- `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `pubtitle` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Username',
- `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Password',
+ `service` varchar(50) NOT NULL,
+ `title` varchar(255) NOT NULL,
+ `pubtitle` varchar(255) NOT NULL,
+ `username` varchar(255) NOT NULL COMMENT 'Username',
+ `password` varchar(255) NOT NULL COMMENT 'Password',
`target_id` int(11) NOT NULL COMMENT 'A target system that this credential is for.',
`points` decimal(10,2) DEFAULT NULL,
- `player_type` enum('offense','defense') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'offense',
- `stock` int(11) DEFAULT '0',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `player_type` enum('offense','defense') NOT NULL DEFAULT 'offense',
+ `stock` int(11) DEFAULT 0,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `service` (`service`,`target_id`,`username`,`password`),
KEY `target_id` (`target_id`),
CONSTRAINT `credential_ibfk_1` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Credentials that participants can discover and claim points.';
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `credits`
+--
+
+DROP TABLE IF EXISTS `credits`;
+CREATE TABLE `credits` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `title` varchar(255) NOT NULL,
+ `body` text DEFAULT NULL,
+ `weight` int(11) DEFAULT 0,
+ `created_at` datetime DEFAULT NULL,
+ `updated_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `crl`
--
DROP TABLE IF EXISTS `crl`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `crl` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`player_id` int(11) DEFAULT NULL,
- `subject` text COLLATE utf8mb4_unicode_ci,
- `csr` text COLLATE utf8mb4_unicode_ci,
- `crt` text COLLATE utf8mb4_unicode_ci,
- `txtcrt` text COLLATE utf8mb4_unicode_ci,
- `privkey` text COLLATE utf8mb4_unicode_ci,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `subject` mediumtext DEFAULT NULL,
+ `csr` mediumtext DEFAULT NULL,
+ `crt` mediumtext DEFAULT NULL,
+ `privkey` mediumtext DEFAULT NULL,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `debuglogs`
--
DROP TABLE IF EXISTS `debuglogs`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `debuglogs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `msg` longtext COLLATE utf8mb4_unicode_ci,
+ `msg` longtext DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `devnull`
+--
+
+DROP TABLE IF EXISTS `devnull`;
+CREATE TABLE `devnull` (
+ `silence` blob DEFAULT NULL
+) ENGINE=BLACKHOLE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `disabled_route`
--
DROP TABLE IF EXISTS `disabled_route`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `disabled_route` (
- `route` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+ `route` varchar(255) NOT NULL,
PRIMARY KEY (`route`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Disabled controller actions for pUI';
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `email_template`
+--
+
+DROP TABLE IF EXISTS `email_template`;
+CREATE TABLE `email_template` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(32) DEFAULT NULL,
+ `title` varchar(255) DEFAULT NULL,
+ `html` mediumtext DEFAULT NULL,
+ `txt` mediumtext DEFAULT NULL,
+ `created_at` datetime DEFAULT NULL,
+ `updated_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `experience`
--
DROP TABLE IF EXISTS `experience`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `experience` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `category` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `description` text COLLATE utf8mb4_unicode_ci,
- `icon` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `name` varchar(255) DEFAULT NULL,
+ `category` varchar(32) DEFAULT NULL,
+ `description` mediumtext DEFAULT NULL,
+ `icon` varchar(255) DEFAULT NULL,
`min_points` int(11) DEFAULT NULL,
`max_points` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
@@ -248,91 +304,83 @@ CREATE TABLE `experience` (
KEY `idx-experience-points-category` (`min_points`,`max_points`,`category`),
KEY `idx-experience-category` (`category`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `faq`
--
DROP TABLE IF EXISTS `faq`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `faq` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `body` text COLLATE utf8mb4_unicode_ci,
+ `title` varchar(255) DEFAULT NULL,
+ `body` mediumtext DEFAULT NULL,
`weight` int(11) DEFAULT NULL,
- PRIMARY KEY (`id`)
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_faq_title` (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `finding`
--
DROP TABLE IF EXISTS `finding`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `finding` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `pubname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Name for the public eyes',
- `description` text COLLATE utf8mb4_unicode_ci,
- `pubdescription` text COLLATE utf8mb4_unicode_ci COMMENT 'Description for the public eyes',
+ `name` varchar(255) DEFAULT NULL,
+ `pubname` varchar(255) DEFAULT NULL COMMENT 'Name for the public eyes',
+ `description` mediumtext DEFAULT NULL,
+ `pubdescription` mediumtext DEFAULT NULL COMMENT 'Description for the public eyes',
`points` decimal(10,2) DEFAULT NULL,
- `stock` int(11) NOT NULL DEFAULT '-1',
- `protocol` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `stock` int(11) NOT NULL DEFAULT -1,
+ `protocol` varchar(30) DEFAULT NULL,
`target_id` int(11) DEFAULT NULL,
- `port` smallint(5) unsigned DEFAULT '0',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `port` smallint(5) unsigned DEFAULT 0,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `protocol` (`protocol`,`target_id`,`port`),
KEY `target_id` (`target_id`),
CONSTRAINT `finding_ibfk_1` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Automatic findings based on network findings';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `headshot`
--
DROP TABLE IF EXISTS `headshot`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `headshot` (
`player_id` int(10) unsigned NOT NULL,
`target_id` int(11) NOT NULL,
`created_at` datetime DEFAULT NULL,
+ `timer` bigint(20) unsigned DEFAULT 0,
+ `rating` smallint(6) DEFAULT -1,
+ `first` tinyint(1) DEFAULT 0,
PRIMARY KEY (`player_id`,`target_id`),
KEY `idx-headshot-player_id` (`player_id`),
KEY `idx-headshot-target_id` (`target_id`),
CONSTRAINT `fk-headshot-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk-headshot-target_id` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `hint`
--
DROP TABLE IF EXISTS `hint`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `hint` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `player_type` enum('offense','defense','both') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `message` text COLLATE utf8mb4_unicode_ci,
- `category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'easy_points',
+ `title` varchar(255) NOT NULL,
+ `player_type` enum('offense','defense','both') DEFAULT NULL,
+ `message` mediumtext DEFAULT NULL,
+ `category` varchar(255) NOT NULL DEFAULT 'easy_points',
`badge_id` int(11) DEFAULT NULL COMMENT 'Display this record after the user received the badge_id',
`finding_id` int(11) DEFAULT NULL COMMENT 'Display this record after the user received the finding_id',
`treasure_id` int(11) DEFAULT NULL COMMENT 'Display this record after the user received the treasure_id',
`question_id` int(11) DEFAULT NULL COMMENT 'Display this record after the user answered the question_id',
`points_user` int(11) DEFAULT NULL COMMENT 'Display this record after the user reaches these many points',
`points_team` int(11) DEFAULT NULL COMMENT 'Display this record after the team reaches these many points',
- `timeafter` bigint(20) DEFAULT '0' COMMENT 'Display this hint after X seconds have been passed since the Start of the event',
- `active` tinyint(1) DEFAULT '1' COMMENT 'Set this hint as active or innactive',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `timeafter` bigint(20) DEFAULT 0 COMMENT 'Display this hint after X seconds have been passed since the Start of the event',
+ `active` tinyint(1) DEFAULT 1 COMMENT 'Set this hint as active or innactive',
+ `ts` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `badge_id` (`badge_id`,`finding_id`,`treasure_id`,`question_id`,`player_type`),
KEY `finding_id` (`finding_id`),
@@ -341,32 +389,26 @@ CREATE TABLE `hint` (
CONSTRAINT `hint_ibfk_2` FOREIGN KEY (`finding_id`) REFERENCES `finding` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `hint_ibfk_3` FOREIGN KEY (`treasure_id`) REFERENCES `treasure` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='The hints for the game based on user type';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `infrastructure`
--
DROP TABLE IF EXISTS `infrastructure`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `infrastructure` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `description` text COLLATE utf8mb4_unicode_ci,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `name` varchar(255) NOT NULL,
+ `description` mediumtext DEFAULT NULL,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Infrastructure elements';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `infrastructure_target`
--
DROP TABLE IF EXISTS `infrastructure_target`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `infrastructure_target` (
`infrastructure_id` int(11) NOT NULL,
`target_id` int(11) NOT NULL,
@@ -375,113 +417,172 @@ CREATE TABLE `infrastructure_target` (
CONSTRAINT `infrastructure_target_ibfk_1` FOREIGN KEY (`infrastructure_id`) REFERENCES `infrastructure` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `infrastructure_target_ibfk_2` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Infrastructure/Target association';
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `init_data`
+--
+
+DROP TABLE IF EXISTS `init_data`;
+CREATE TABLE `init_data` (
+ `version` varchar(180) NOT NULL,
+ `apply_time` int(11) DEFAULT NULL,
+ PRIMARY KEY (`version`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+
+--
+-- Table structure for table `inquiry`
+--
+
+DROP TABLE IF EXISTS `inquiry`;
+CREATE TABLE `inquiry` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `player_id` int(11) unsigned NOT NULL,
+ `answered` tinyint(1) NOT NULL DEFAULT 0,
+ `category` varchar(255) DEFAULT 'contact',
+ `name` varchar(255) DEFAULT NULL,
+ `email` varchar(255) DEFAULT NULL,
+ `serialized` mediumtext DEFAULT NULL,
+ `body` mediumtext DEFAULT NULL,
+ `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `created_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `idx-inquiry-player_id` (`player_id`),
+ CONSTRAINT `fk-inquiry-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `instruction`
--
DROP TABLE IF EXISTS `instruction`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `instruction` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `player_type` enum('offense','defense','both') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `message` text COLLATE utf8mb4_unicode_ci,
- `weight` int(11) NOT NULL DEFAULT '0',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `title` varchar(255) DEFAULT NULL,
+ `player_type` enum('offense','defense','both') DEFAULT NULL,
+ `message` mediumtext DEFAULT NULL,
+ `weight` int(11) NOT NULL DEFAULT 0,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `title` (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='The instructions for the game for each player type';
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `language`
+--
+
+DROP TABLE IF EXISTS `language`;
+CREATE TABLE `language` (
+ `id` varchar(8) NOT NULL,
+ `l` varchar(36) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `layout_override`
+--
+
+DROP TABLE IF EXISTS `layout_override`;
+CREATE TABLE `layout_override` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) NOT NULL,
+ `route` varchar(255) DEFAULT NULL,
+ `guest` tinyint(1) NOT NULL DEFAULT 0,
+ `player_id` int(11) DEFAULT NULL,
+ `css` text DEFAULT NULL,
+ `js` text DEFAULT NULL,
+ `repeating` tinyint(1) NOT NULL DEFAULT 0,
+ `valid_from` datetime NOT NULL,
+ `valid_until` datetime NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `level`
--
DROP TABLE IF EXISTS `level`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `level` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `description` text COLLATE utf8mb4_unicode_ci,
+ `name` varchar(255) NOT NULL,
+ `description` mediumtext DEFAULT NULL,
`points` decimal(10,2) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `points` (`points`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Player level standings';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `migration`
--
DROP TABLE IF EXISTS `migration`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `migration` (
- `version` varchar(180) COLLATE utf8mb4_unicode_ci NOT NULL,
+ `version` varchar(180) NOT NULL,
`apply_time` int(11) DEFAULT NULL,
PRIMARY KEY (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `migration_red`
--
DROP TABLE IF EXISTS `migration_red`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `migration_red` (
- `version` varchar(180) COLLATE utf8mb4_unicode_ci NOT NULL,
+ `version` varchar(180) NOT NULL,
+ `apply_time` int(11) DEFAULT NULL,
+ PRIMARY KEY (`version`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `migration_sales`
+--
+
+DROP TABLE IF EXISTS `migration_sales`;
+CREATE TABLE `migration_sales` (
+ `version` varchar(180) NOT NULL,
`apply_time` int(11) DEFAULT NULL,
PRIMARY KEY (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `muisess`
--
DROP TABLE IF EXISTS `muisess`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `muisess` (
- `id` char(40) COLLATE utf8mb4_unicode_ci NOT NULL,
+ `id` char(40) NOT NULL,
`expire` int(11) DEFAULT NULL,
- `data` blob,
+ `data` blob DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='mUI Sessions table';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `network`
--
DROP TABLE IF EXISTS `network`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `network` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
- `description` text COLLATE utf8mb4_unicode_ci,
- `public` tinyint(1) DEFAULT '1',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `name` varchar(32) NOT NULL,
+ `description` mediumtext DEFAULT NULL,
+ `public` tinyint(1) DEFAULT 1,
+ `guest` tinyint(1) NOT NULL DEFAULT 0,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `active` tinyint(1) DEFAULT 1,
+ `announce` tinyint(1) DEFAULT 1,
+ `codename` varchar(255) DEFAULT NULL,
+ `icon` varchar(255) DEFAULT NULL,
+ `weight` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
- UNIQUE KEY `name` (`name`)
+ UNIQUE KEY `name` (`name`),
+ KEY `idx-network-weight` (`weight`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `network_player`
--
DROP TABLE IF EXISTS `network_player`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `network_player` (
`network_id` int(11) NOT NULL,
`player_id` int(11) unsigned NOT NULL,
@@ -493,298 +594,497 @@ CREATE TABLE `network_player` (
CONSTRAINT `fk-network_player-network_id` FOREIGN KEY (`network_id`) REFERENCES `network` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk-network_player-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `network_target`
--
DROP TABLE IF EXISTS `network_target`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `network_target` (
`network_id` int(11) NOT NULL,
`target_id` int(11) NOT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
+ `weight` smallint(6) DEFAULT NULL,
PRIMARY KEY (`network_id`,`target_id`),
KEY `idx-network_target-network_id` (`network_id`),
KEY `idx-network_target-target_id` (`target_id`),
CONSTRAINT `fk-network_target-network_id` FOREIGN KEY (`network_id`) REFERENCES `network` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk-network_target-target_id` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `network_target_schedule`
+--
+
+DROP TABLE IF EXISTS `network_target_schedule`;
+CREATE TABLE `network_target_schedule` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `target_id` int(11) NOT NULL,
+ `network_id` int(11) DEFAULT NULL,
+ `migration_date` datetime NOT NULL,
+ `created_at` datetime NOT NULL,
+ `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY (`id`),
+ KEY `idx-network_target_schedule-target_id` (`target_id`),
+ KEY `idx-network_target_schedule-network_id` (`network_id`),
+ CONSTRAINT `fk-network_target_schedule-network_id` FOREIGN KEY (`network_id`) REFERENCES `network` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
+ CONSTRAINT `fk-network_target_schedule-target_id` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `news`
+--
+
+DROP TABLE IF EXISTS `news`;
+CREATE TABLE `news` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `title` varchar(255) DEFAULT NULL,
+ `body` mediumtext DEFAULT NULL,
+ `category` varchar(255) DEFAULT NULL,
+ `created_at` datetime DEFAULT NULL,
+ `updated_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `notification`
--
DROP TABLE IF EXISTS `notification`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `notification` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`player_id` int(11) unsigned NOT NULL,
- `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `body` text COLLATE utf8mb4_unicode_ci,
- `archived` tinyint(1) DEFAULT '0',
+ `category` varchar(20) NOT NULL DEFAULT 'success',
+ `title` varchar(255) DEFAULT NULL,
+ `body` mediumtext DEFAULT NULL,
+ `archived` tinyint(1) DEFAULT 0,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx-notification-player_id` (`player_id`),
+ KEY `idx-notification-archived` (`archived`),
+ KEY `idx-notification-category` (`category`),
CONSTRAINT `fk-notification-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `objective`
--
DROP TABLE IF EXISTS `objective`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `objective` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `player_type` enum('offense','defense','both') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `message` text COLLATE utf8mb4_unicode_ci,
- `weight` int(11) NOT NULL DEFAULT '0',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `title` varchar(255) DEFAULT NULL,
+ `player_type` enum('offense','defense','both') DEFAULT NULL,
+ `message` mediumtext DEFAULT NULL,
+ `weight` int(11) NOT NULL DEFAULT 0,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `title` (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='The objectives for the game based on player type';
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `openvpn`
+--
+
+DROP TABLE IF EXISTS `openvpn`;
+CREATE TABLE `openvpn` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `server` varchar(255) DEFAULT NULL,
+ `provider_id` varchar(255) DEFAULT NULL,
+ `name` varchar(255) DEFAULT NULL,
+ `net` int(11) unsigned DEFAULT NULL,
+ `mask` int(11) unsigned DEFAULT NULL,
+ `management_ip` int(11) unsigned DEFAULT NULL,
+ `management_port` smallint(6) unsigned DEFAULT NULL,
+ `management_passwd` varchar(255) DEFAULT NULL,
+ `status_log` varchar(255) DEFAULT NULL,
+ `conf` text DEFAULT NULL,
+ `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `server_name_net` (`server`,`name`,`net`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `pages`
+--
+
+DROP TABLE IF EXISTS `pages`;
+CREATE TABLE `pages` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `metatags` text DEFAULT NULL,
+ `title` varchar(255) DEFAULT NULL,
+ `slug` varchar(255) NOT NULL,
+ `body` longtext DEFAULT NULL,
+ `created_at` datetime DEFAULT NULL,
+ `updated_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `slug` (`slug`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `player`
--
DROP TABLE IF EXISTS `player`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `player` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `fullname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `type` enum('offense','defense') COLLATE utf8mb4_unicode_ci DEFAULT 'offense',
- `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'password',
- `activkey` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `username` varchar(255) NOT NULL,
+ `fullname` varchar(255) DEFAULT NULL,
+ `email` varchar(255) DEFAULT NULL,
+ `type` enum('offense','defense') DEFAULT 'offense',
+ `password` varchar(255) NOT NULL DEFAULT 'password',
+ `activkey` varchar(255) DEFAULT NULL,
`created` datetime DEFAULT NULL,
- `active` tinyint(1) DEFAULT '1',
- `academic` tinyint(1) DEFAULT '0',
- `status` int(11) DEFAULT '0',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `auth_key` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
- `password_hash` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `password_reset_token` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `verification_token` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `admin` smallint(6) DEFAULT '0',
+ `active` tinyint(1) DEFAULT 1,
+ `academic` tinyint(1) DEFAULT 0,
+ `status` int(11) DEFAULT 0,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `auth_key` varchar(32) NOT NULL,
+ `password_hash` varchar(255) NOT NULL,
+ `admin` smallint(6) DEFAULT 0,
+ `stripe_customer_id` varchar(255) DEFAULT NULL,
+ `approval` int(11) DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
+ UNIQUE KEY `player_email_idx` (`email`),
KEY `idx-player-status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `player_badge`
--
DROP TABLE IF EXISTS `player_badge`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `player_badge` (
`player_id` int(10) unsigned NOT NULL,
`badge_id` int(11) NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`player_id`,`badge_id`),
KEY `badge_id` (`badge_id`),
CONSTRAINT `player_badge_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `player_badge_ibfk_2` FOREIGN KEY (`badge_id`) REFERENCES `badge` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='The badges each user will get to see';
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `player_counter_nf`
+--
+
+DROP TABLE IF EXISTS `player_counter_nf`;
+CREATE TABLE `player_counter_nf` (
+ `player_id` int(11) NOT NULL,
+ `metric` varchar(255) NOT NULL,
+ `counter` bigint(20) NOT NULL DEFAULT 0,
+ PRIMARY KEY (`player_id`,`metric`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `player_country_rank`
+--
+
+DROP TABLE IF EXISTS `player_country_rank`;
+CREATE TABLE `player_country_rank` (
+ `id` int(11) NOT NULL DEFAULT 0,
+ `player_id` int(11) unsigned NOT NULL,
+ `country` varchar(3) NOT NULL,
+ PRIMARY KEY (`id`,`country`),
+ UNIQUE KEY `idx-player_country_rank-player_id` (`player_id`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `player_disabledroute`
+--
+
+DROP TABLE IF EXISTS `player_disabledroute`;
+CREATE TABLE `player_disabledroute` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `player_id` int(11) unsigned DEFAULT NULL,
+ `route` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `idx-player_disabledroute-player_id` (`player_id`),
+ KEY `idx-player_disabledroute-route` (`route`),
+ CONSTRAINT `fk-player_disabledroute-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `player_disconnect_queue`
+--
+
+DROP TABLE IF EXISTS `player_disconnect_queue`;
+CREATE TABLE `player_disconnect_queue` (
+ `player_id` int(10) unsigned NOT NULL,
+ `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY (`player_id`),
+ CONSTRAINT `fk-player_id-player` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `player_disconnect_queue_history`
+--
+
+DROP TABLE IF EXISTS `player_disconnect_queue_history`;
+CREATE TABLE `player_disconnect_queue_history` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `player_id` int(11) NOT NULL,
+ `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `player_finding`
--
DROP TABLE IF EXISTS `player_finding`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `player_finding` (
`player_id` int(10) unsigned NOT NULL,
`finding_id` int(11) NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp(),
+ `points` float DEFAULT NULL,
PRIMARY KEY (`player_id`,`finding_id`),
KEY `finding_id` (`finding_id`),
CONSTRAINT `player_finding_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `player_finding_ibfk_2` FOREIGN KEY (`finding_id`) REFERENCES `finding` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='The user findings each user will get to see';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `player_hint`
--
DROP TABLE IF EXISTS `player_hint`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `player_hint` (
`player_id` int(10) unsigned NOT NULL,
`hint_id` int(11) NOT NULL,
- `status` tinyint(4) DEFAULT '1',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `status` tinyint(4) DEFAULT 1,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`player_id`,`hint_id`),
KEY `hint_id` (`hint_id`),
CONSTRAINT `player_hint_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `player_hint_ibfk_2` FOREIGN KEY (`hint_id`) REFERENCES `hint` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='The hints each user will get to see';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `player_last`
--
DROP TABLE IF EXISTS `player_last`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `player_last` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`on_pui` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`on_vpn` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`vpn_remote_address` int(11) unsigned DEFAULT NULL,
`vpn_local_address` int(11) unsigned DEFAULT NULL,
+ `signup_ip` int(10) unsigned DEFAULT NULL,
+ `signin_ip` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx-player_last-on_pui` (`on_pui`),
KEY `idx-player_last-on_vpn` (`on_vpn`),
KEY `idx-player_last-vpn_remote_address` (`vpn_remote_address`),
KEY `idx-player_last-vpn_local_address` (`vpn_local_address`),
- KEY `idx-player_last-combined` (`vpn_local_address`,`vpn_remote_address`,`on_vpn`,`on_pui`)
+ KEY `idx-player_last-combined` (`vpn_local_address`,`vpn_remote_address`,`on_vpn`,`on_pui`),
+ KEY `idx-player_last-signup_ip` (`signup_ip`),
+ KEY `idx-player_last-signin_ip` (`signin_ip`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `player_metadata`
+--
+
+DROP TABLE IF EXISTS `player_metadata`;
+CREATE TABLE `player_metadata` (
+ `player_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `identificationFile` varchar(64) DEFAULT NULL,
+ `affiliation` varchar(64) DEFAULT NULL,
+ PRIMARY KEY (`player_id`),
+ KEY `idx-player_metadata-player_id` (`player_id`),
+ CONSTRAINT `fk-player_metadata-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `player_question`
--
DROP TABLE IF EXISTS `player_question`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `player_question` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`question_id` int(11) NOT NULL,
`player_id` int(10) unsigned DEFAULT NULL,
`points` decimal(10,2) DEFAULT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
- KEY `question_id` (`question_id`),
+ UNIQUE KEY `uidx-player_question-player_id-question_id` (`question_id`,`player_id`),
KEY `player_id` (`player_id`),
CONSTRAINT `player_question_ibfk_1` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `player_question_ibfk_2` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `player_rank`
--
DROP TABLE IF EXISTS `player_rank`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `player_rank` (
- `id` int(11) unsigned NOT NULL DEFAULT '0',
+ `id` int(11) unsigned NOT NULL DEFAULT 0,
`player_id` int(11) NOT NULL,
- PRIMARY KEY (`id`),
+ PRIMARY KEY (`id`,`player_id`),
UNIQUE KEY `player_id` (`player_id`),
KEY `idx-player_rank-player_id` (`player_id`)
) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `player_relation`
+--
+
+DROP TABLE IF EXISTS `player_relation`;
+CREATE TABLE `player_relation` (
+ `player_id` int(11) unsigned NOT NULL,
+ `referred_id` int(11) unsigned DEFAULT NULL,
+ PRIMARY KEY (`player_id`),
+ KEY `idx-player_relation-player_id` (`player_id`),
+ KEY `idx-player_relation-referred_id` (`referred_id`),
+ CONSTRAINT `fk-player_relation-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `player_score`
--
DROP TABLE IF EXISTS `player_score`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `player_score` (
`player_id` int(10) unsigned NOT NULL,
- `points` bigint(20) NOT NULL DEFAULT '0',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `points` bigint(20) NOT NULL DEFAULT 0,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`player_id`),
KEY `idx-player_score-points` (`points`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `player_score_monthly`
+--
+
+DROP TABLE IF EXISTS `player_score_monthly`;
+CREATE TABLE `player_score_monthly` (
+ `player_id` int(11) NOT NULL,
+ `points` bigint(20) NOT NULL DEFAULT 0,
+ `dated_at` int(11) NOT NULL,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY (`player_id`,`dated_at`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `player_spin`
--
DROP TABLE IF EXISTS `player_spin`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `player_spin` (
`player_id` int(11) unsigned NOT NULL,
`counter` int(11) DEFAULT NULL,
`total` int(11) DEFAULT NULL,
`updated_at` date DEFAULT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `perday` tinyint(3) DEFAULT NULL,
PRIMARY KEY (`player_id`),
KEY `idx-player_spin-player_id` (`player_id`),
CONSTRAINT `fk-player_spin-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `player_ssl`
--
DROP TABLE IF EXISTS `player_ssl`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `player_ssl` (
`player_id` int(10) unsigned NOT NULL,
- `subject` text COLLATE utf8mb4_unicode_ci NOT NULL,
- `csr` text COLLATE utf8mb4_unicode_ci NOT NULL,
- `crt` text COLLATE utf8mb4_unicode_ci NOT NULL,
- `txtcrt` text COLLATE utf8mb4_unicode_ci NOT NULL,
- `privkey` text COLLATE utf8mb4_unicode_ci NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `serial` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `subject` mediumtext NOT NULL,
+ `csr` mediumtext NOT NULL,
+ `crt` mediumtext NOT NULL,
+ `privkey` mediumtext NOT NULL,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`player_id`),
+ UNIQUE KEY `serial` (`serial`),
CONSTRAINT `player_ssl_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Player SSL Keys';
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `player_target_help`
+--
+
+DROP TABLE IF EXISTS `player_target_help`;
+CREATE TABLE `player_target_help` (
+ `player_id` int(11) unsigned NOT NULL,
+ `target_id` int(11) NOT NULL,
+ `created_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`player_id`,`target_id`),
+ KEY `idx-player_target_help-player_id` (`player_id`),
+ KEY `idx-player_target_help-target_id` (`target_id`),
+ CONSTRAINT `fk-player_target_help-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE,
+ CONSTRAINT `fk-player_target_help-target_id` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `player_token`
+--
+
+DROP TABLE IF EXISTS `player_token`;
+CREATE TABLE `player_token` (
+ `player_id` int(11) unsigned NOT NULL,
+ `type` varchar(32) NOT NULL DEFAULT 'API',
+ `token` varchar(128) NOT NULL,
+ `description` text NOT NULL DEFAULT '',
+ `expires_at` datetime DEFAULT NULL,
+ `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY (`player_id`,`type`),
+ UNIQUE KEY `token` (`token`),
+ CONSTRAINT `fk-player_token-player_id-player` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `player_token_history`
+--
+
+DROP TABLE IF EXISTS `player_token_history`;
+CREATE TABLE `player_token_history` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `player_id` int(11) unsigned NOT NULL,
+ `type` varchar(32) NOT NULL DEFAULT 'API',
+ `token` varchar(128) NOT NULL,
+ `description` text NOT NULL DEFAULT '',
+ `expires_at` datetime DEFAULT NULL,
+ `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (`id`),
+ KEY `fk-player_token_history-player_id-player` (`player_id`),
+ CONSTRAINT `fk-player_token_history-player_id-player` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `player_treasure`
--
DROP TABLE IF EXISTS `player_treasure`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `player_treasure` (
`player_id` int(10) unsigned NOT NULL,
`treasure_id` int(11) NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp(),
+ `points` float DEFAULT NULL,
PRIMARY KEY (`player_id`,`treasure_id`),
KEY `treasure_id` (`treasure_id`),
CONSTRAINT `player_treasure_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `player_treasure_ibfk_2` FOREIGN KEY (`treasure_id`) REFERENCES `treasure` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='The treasures each user will get to see';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `player_tutorial_task`
--
DROP TABLE IF EXISTS `player_tutorial_task`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `player_tutorial_task` (
`player_id` int(11) unsigned NOT NULL,
- `tutorial_task_dependency_id` int(11) NOT NULL DEFAULT '0',
- `points` int(11) NOT NULL DEFAULT '0',
+ `tutorial_task_dependency_id` int(11) NOT NULL DEFAULT 0,
+ `points` int(11) NOT NULL DEFAULT 0,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`player_id`,`tutorial_task_dependency_id`),
@@ -793,48 +1093,47 @@ CREATE TABLE `player_tutorial_task` (
CONSTRAINT `fk-player_tutorial_task-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk-player_tutorial_task-tutorial_task_dependency_id` FOREIGN KEY (`tutorial_task_dependency_id`) REFERENCES `tutorial_task_dependency` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `player_vpn_history`
--
DROP TABLE IF EXISTS `player_vpn_history`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `player_vpn_history` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`player_id` int(11) DEFAULT NULL,
`vpn_remote_address` int(11) unsigned DEFAULT NULL,
`vpn_local_address` int(11) DEFAULT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `profile`
--
DROP TABLE IF EXISTS `profile`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `profile` (
- `id` bigint(20) unsigned NOT NULL DEFAULT '0',
+ `id` bigint(20) unsigned NOT NULL DEFAULT 0,
`player_id` int(11) unsigned NOT NULL,
- `visibility` enum('public','private','ingame') COLLATE utf8mb4_unicode_ci DEFAULT 'private',
- `bio` text COLLATE utf8mb4_unicode_ci,
- `country` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT 'UNK' COMMENT 'Country code (eg GR)',
- `avatar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT 'default.png' COMMENT 'Profile avatar',
- `discord` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'Discord handle (eg @username#1234)',
- `twitter` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'Twitter handle (eg @echoCTF)',
- `github` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'Github handle (eg echoCTF)',
- `htb` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'HTB Profile (eg 47396)',
- `terms_and_conditions` tinyint(1) DEFAULT '0' COMMENT 'Accepted Terms and Conditions?',
- `mail_optin` tinyint(1) DEFAULT '0' COMMENT 'Opt in for mail notifications?',
- `gdpr` tinyint(1) DEFAULT '0' COMMENT 'GDPR Acceptance?',
+ `visibility` enum('public','private','ingame') DEFAULT 'private',
+ `bio` mediumtext DEFAULT NULL,
+ `country` varchar(3) DEFAULT 'UNK' COMMENT 'Country code (eg GR)',
+ `avatar` varchar(255) DEFAULT 'default.png' COMMENT 'Profile avatar',
+ `discord` varchar(255) DEFAULT '' COMMENT 'Discord handle (eg @username#1234)',
+ `twitter` varchar(255) DEFAULT '' COMMENT 'Twitter handle (eg @echoCTF)',
+ `github` varchar(255) DEFAULT '' COMMENT 'Github handle (eg echoCTF)',
+ `htb` varchar(255) DEFAULT '' COMMENT 'HTB Profile (eg 47396)',
+ `terms_and_conditions` tinyint(1) DEFAULT 0 COMMENT 'Accepted Terms and Conditions?',
+ `mail_optin` tinyint(1) DEFAULT 0 COMMENT 'Opt in for mail notifications?',
+ `gdpr` tinyint(1) DEFAULT 0 COMMENT 'GDPR Acceptance?',
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
+ `approved_avatar` tinyint(1) DEFAULT 1,
+ `youtube` varchar(255) DEFAULT NULL,
+ `twitch` varchar(255) DEFAULT NULL,
+ `echoctf` int(11) unsigned DEFAULT NULL,
+ `pending_progress` tinyint(1) NOT NULL DEFAULT 1,
PRIMARY KEY (`id`),
UNIQUE KEY `player_id` (`player_id`),
KEY `idx-profile-gdpr` (`gdpr`),
@@ -848,103 +1147,150 @@ CREATE TABLE `profile` (
KEY `idx-profile-created-updated-at` (`created_at`,`updated_at`),
KEY `idx-profile-multiple` (`visibility`,`country`,`id`,`player_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `question`
--
DROP TABLE IF EXISTS `question`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `question` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`challenge_id` int(11) NOT NULL,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `description` text COLLATE utf8mb4_unicode_ci,
+ `name` varchar(255) DEFAULT NULL,
+ `description` mediumtext DEFAULT NULL,
`points` decimal(10,2) DEFAULT NULL,
- `player_type` enum('offense','defense') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'offense',
- `code` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `weight` int(11) NOT NULL DEFAULT '0',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `parent` int(11) DEFAULT '0',
+ `player_type` enum('offense','defense') NOT NULL DEFAULT 'offense',
+ `code` varchar(128) DEFAULT NULL,
+ `weight` int(11) NOT NULL DEFAULT 0,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `parent` int(11) DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `challenge_id` (`challenge_id`,`name`),
CONSTRAINT `question_ibfk_1` FOREIGN KEY (`challenge_id`) REFERENCES `challenge` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `report`
--
DROP TABLE IF EXISTS `report`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `report` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `title` varchar(255) DEFAULT NULL,
`player_id` int(11) unsigned NOT NULL,
- `body` longtext COLLATE utf8mb4_unicode_ci,
- `status` enum('pending','invalid','approved') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
- `points` int(11) NOT NULL DEFAULT '0',
- `modcomment` longtext COLLATE utf8mb4_unicode_ci COMMENT 'The comment from the moderator about the report',
- `pubtitle` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `pubbody` longtext COLLATE utf8mb4_unicode_ci,
+ `body` longtext DEFAULT NULL,
+ `status` enum('pending','invalid','approved') NOT NULL DEFAULT 'pending',
+ `points` int(11) NOT NULL DEFAULT 0,
+ `modcomment` longtext DEFAULT NULL COMMENT 'The comment from the moderator about the report',
+ `pubtitle` varchar(255) DEFAULT NULL,
+ `pubbody` longtext DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `player_id` (`player_id`),
CONSTRAINT `report_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `rule`
--
DROP TABLE IF EXISTS `rule`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `rule` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `player_type` enum('offense','defense','both') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `message` text COLLATE utf8mb4_unicode_ci,
- `weight` int(11) NOT NULL DEFAULT '0',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `title` varchar(255) DEFAULT NULL,
+ `player_type` enum('offense','defense','both') DEFAULT NULL,
+ `message` mediumtext DEFAULT NULL,
+ `weight` int(11) NOT NULL DEFAULT 0,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `title` (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='The rules for the game based on player type';
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `server`
+--
+
+DROP TABLE IF EXISTS `server`;
+CREATE TABLE `server` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(32) NOT NULL,
+ `network` varchar(32) NOT NULL,
+ `ip` int(11) unsigned NOT NULL,
+ `description` text DEFAULT NULL,
+ `service` enum('docker') NOT NULL DEFAULT 'docker',
+ `connstr` varchar(255) NOT NULL,
+ `provider_id` varchar(255) DEFAULT NULL,
+ `ssl` tinyint(1) NOT NULL DEFAULT 0,
+ `timeout` int(11) NOT NULL DEFAULT 9000,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `sessions`
--
DROP TABLE IF EXISTS `sessions`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `sessions` (
- `id` char(32) COLLATE utf8mb4_unicode_ci NOT NULL,
+ `id` char(32) NOT NULL,
`expire` int(11) DEFAULT NULL,
- `data` longblob,
+ `data` longblob DEFAULT NULL,
`player_id` int(10) unsigned DEFAULT NULL,
`ip` bigint(20) unsigned DEFAULT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
KEY `expire` (`expire`),
KEY `id` (`id`,`expire`),
KEY `player_id` (`player_id`),
CONSTRAINT `sessions_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `speed_problem`
+--
+
+DROP TABLE IF EXISTS `speed_problem`;
+CREATE TABLE `speed_problem` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) DEFAULT NULL,
+ `description` text DEFAULT NULL,
+ `active` tinyint(1) NOT NULL DEFAULT 1,
+ `difficulty` smallint(6) NOT NULL DEFAULT 0,
+ `category` varchar(64) DEFAULT NULL,
+ `server` varchar(255) DEFAULT NULL,
+ `challenge_image` varchar(255) DEFAULT NULL,
+ `validator_image` varchar(255) DEFAULT NULL,
+ `created_at` datetime DEFAULT NULL,
+ `updated_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `speed_solution`
+--
+
+DROP TABLE IF EXISTS `speed_solution`;
+CREATE TABLE `speed_solution` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `player_id` int(11) unsigned NOT NULL,
+ `problem_id` int(11) NOT NULL,
+ `language` varchar(255) DEFAULT NULL,
+ `sourcecode` longblob DEFAULT NULL,
+ `status` varchar(255) DEFAULT NULL,
+ `points` int(11) DEFAULT 0,
+ `created_at` datetime DEFAULT NULL,
+ `updated_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `idx-speed_solution-player_id` (`player_id`),
+ KEY `idx-speed_solution-problem_id` (`problem_id`),
+ CONSTRAINT `fk-speed_solution-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE,
+ CONSTRAINT `fk-speed_solution-problem_id` FOREIGN KEY (`problem_id`) REFERENCES `speed_problem` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `spin_history`
--
DROP TABLE IF EXISTS `spin_history`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `spin_history` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`target_id` int(11) NOT NULL,
@@ -957,15 +1303,12 @@ CREATE TABLE `spin_history` (
CONSTRAINT `fk-spin_history-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk-spin_history-target_id` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `spin_queue`
--
DROP TABLE IF EXISTS `spin_queue`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `spin_queue` (
`target_id` int(11) NOT NULL,
`player_id` int(11) unsigned NOT NULL,
@@ -976,75 +1319,77 @@ CREATE TABLE `spin_queue` (
CONSTRAINT `fk-spin_queue-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk-spin_queue-target_id` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `stream`
--
DROP TABLE IF EXISTS `stream`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `stream` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`player_id` int(10) unsigned DEFAULT NULL,
- `model` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `model` varchar(255) DEFAULT NULL,
`model_id` int(11) DEFAULT NULL,
- `points` int(11) DEFAULT '0',
- `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `message` text COLLATE utf8mb4_unicode_ci,
- `pubtitle` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `pubmessage` text COLLATE utf8mb4_unicode_ci,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `points` int(11) DEFAULT 0,
+ `title` varchar(255) NOT NULL,
+ `message` mediumtext DEFAULT NULL,
+ `pubtitle` varchar(255) NOT NULL,
+ `pubmessage` mediumtext DEFAULT NULL,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
KEY `player_id` (`player_id`),
CONSTRAINT `stream_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Information stream for participants and public alike';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `sysconfig`
--
DROP TABLE IF EXISTS `sysconfig`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `sysconfig` (
- `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `val` longblob,
- `description` longblob,
+ `id` varchar(255) NOT NULL,
+ `val` longblob DEFAULT NULL,
+ `description` longblob DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Very simple table keeping single key/val pairs';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `target`
--
DROP TABLE IF EXISTS `target`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `target` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'target ID',
- `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'A name for the target',
- `fqdn` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'The FQDN for the target',
- `purpose` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'The purpose of this target',
- `description` text COLLATE utf8mb4_unicode_ci,
+ `name` varchar(255) DEFAULT NULL COMMENT 'A name for the target',
+ `fqdn` varchar(255) DEFAULT NULL COMMENT 'The FQDN for the target',
+ `purpose` varchar(255) DEFAULT NULL COMMENT 'The purpose of this target',
+ `description` mediumtext DEFAULT NULL,
`ip` int(10) unsigned NOT NULL COMMENT 'The IP of the target',
- `mac` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'The mac associated with this IP',
- `active` tinyint(1) DEFAULT '1',
- `status` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT 'offline',
+ `mac` varchar(30) DEFAULT NULL COMMENT 'The mac associated with this IP',
+ `active` tinyint(1) DEFAULT 1,
+ `status` varchar(32) DEFAULT 'offline',
`scheduled_at` datetime DEFAULT NULL,
- `net` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Network this pod is attached',
- `server` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Docker Server connection string.',
- `image` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '',
- `dns` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `parameters` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `rootable` tinyint(1) DEFAULT '0' COMMENT 'Whether the target is rootable or not',
- `difficulty` int(11) DEFAULT '0',
- `suggested_xp` int(11) DEFAULT '0',
- `required_xp` int(11) DEFAULT '0',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `net` varchar(255) DEFAULT NULL COMMENT 'Network this pod is attached',
+ `server` varchar(255) DEFAULT NULL COMMENT 'Docker Server connection string.',
+ `image` varchar(255) DEFAULT '',
+ `dns` varchar(255) DEFAULT NULL,
+ `parameters` mediumtext DEFAULT NULL CHECK (json_valid(`parameters`)),
+ `rootable` tinyint(1) DEFAULT 0 COMMENT 'Whether the target is rootable or not',
+ `difficulty` int(11) DEFAULT 0,
+ `suggested_xp` int(11) DEFAULT 0,
+ `required_xp` int(11) DEFAULT 0,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `timer` tinyint(1) DEFAULT 1,
+ `created_at` datetime DEFAULT NULL,
+ `weight` int(11) NOT NULL DEFAULT 0,
+ `healthcheck` tinyint(1) NOT NULL DEFAULT 1,
+ `category` varchar(255) DEFAULT NULL,
+ `imageparams` mediumtext DEFAULT NULL CHECK (json_valid(`imageparams`)),
+ `writeup_allowed` int(11) DEFAULT 1,
+ `player_spin` tinyint(1) DEFAULT 1,
+ `headshot_spin` tinyint(1) DEFAULT 1,
+ `instance_allowed` smallint(6) DEFAULT 1,
+ `require_findings` tinyint(1) DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `fqdn` (`fqdn`),
@@ -1052,177 +1397,355 @@ CREATE TABLE `target` (
KEY `idx-target-suggested_xp` (`suggested_xp`),
KEY `idx-target-required_xp` (`required_xp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Keeps track of the CTF target IP and MAC addresses along with simple asset management';
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `target_instance`
+--
+
+DROP TABLE IF EXISTS `target_instance`;
+CREATE TABLE `target_instance` (
+ `player_id` int(11) unsigned NOT NULL,
+ `target_id` int(11) NOT NULL,
+ `server_id` int(11) DEFAULT NULL,
+ `ip` int(11) unsigned DEFAULT 0,
+ `reboot` tinyint(3) unsigned NOT NULL DEFAULT 0,
+ `created_at` datetime(3) NOT NULL DEFAULT current_timestamp(3),
+ `updated_at` datetime(3) NOT NULL DEFAULT current_timestamp(3),
+ `team_allowed` tinyint(1) NOT NULL DEFAULT 0,
+ PRIMARY KEY (`player_id`),
+ KEY `idx-target_instance-target_id` (`target_id`),
+ CONSTRAINT `fk-target_instance-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE,
+ CONSTRAINT `fk-target_instance-target_id` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `target_instance_audit`
+--
+
+DROP TABLE IF EXISTS `target_instance_audit`;
+CREATE TABLE `target_instance_audit` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `op` char(1) NOT NULL DEFAULT 'i',
+ `player_id` int(11) unsigned NOT NULL,
+ `target_id` int(11) NOT NULL,
+ `server_id` int(11) DEFAULT NULL,
+ `ip` int(11) unsigned DEFAULT 0,
+ `reboot` tinyint(3) unsigned NOT NULL DEFAULT 0,
+ `ts` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
+ `team_allowed` tinyint(1) NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`),
+ KEY `idx-target_instance_audit-player_id` (`player_id`),
+ KEY `idx-target_instance_audit-target_id` (`target_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `target_metadata`
+--
+
+DROP TABLE IF EXISTS `target_metadata`;
+CREATE TABLE `target_metadata` (
+ `target_id` int(11) NOT NULL AUTO_INCREMENT,
+ `scenario` mediumtext DEFAULT NULL,
+ `instructions` mediumtext DEFAULT NULL,
+ `solution` mediumtext DEFAULT NULL,
+ `pre_credits` mediumtext DEFAULT NULL,
+ `post_credits` mediumtext DEFAULT NULL,
+ `pre_exploitation` mediumtext DEFAULT NULL,
+ `post_exploitation` mediumtext DEFAULT NULL,
+ `created_at` datetime DEFAULT NULL,
+ `updated_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`target_id`),
+ CONSTRAINT `fk-target_metadata-target_id` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `target_ondemand`
+--
+
+DROP TABLE IF EXISTS `target_ondemand`;
+CREATE TABLE `target_ondemand` (
+ `target_id` int(11) NOT NULL,
+ `player_id` int(11) unsigned DEFAULT NULL,
+ `state` tinyint(3) NOT NULL DEFAULT -1,
+ `heartbeat` datetime DEFAULT NULL,
+ `created_at` datetime DEFAULT NULL,
+ `updated_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`target_id`),
+ KEY `idx-target_ondemand-target_id` (`target_id`),
+ KEY `idx-target_ondemand-player_id` (`player_id`),
+ CONSTRAINT `fk-target_ondemand-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE SET NULL,
+ CONSTRAINT `fk-target_ondemand-target_id` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `target_player_state`
+--
+
+DROP TABLE IF EXISTS `target_player_state`;
+CREATE TABLE `target_player_state` (
+ `id` int(11) NOT NULL,
+ `player_id` int(11) unsigned NOT NULL,
+ `player_treasures` int(11) NOT NULL DEFAULT 0,
+ `player_findings` int(11) NOT NULL DEFAULT 0,
+ `player_points` int(11) NOT NULL DEFAULT 0,
+ `created_at` datetime DEFAULT NULL,
+ `updated_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`id`,`player_id`),
+ KEY `fk-target_player_state-player_id` (`player_id`),
+ KEY `idx-target_player_state-player_treasures` (`player_treasures`),
+ KEY `idx-target_player_state-player_findings` (`player_findings`),
+ CONSTRAINT `fk-target_player_state-id` FOREIGN KEY (`id`) REFERENCES `target` (`id`) ON DELETE CASCADE,
+ CONSTRAINT `fk-target_player_state-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `target_state`
+--
+
+DROP TABLE IF EXISTS `target_state`;
+CREATE TABLE `target_state` (
+ `id` int(11) NOT NULL,
+ `total_headshots` int(11) unsigned NOT NULL DEFAULT 0,
+ `total_findings` int(11) unsigned NOT NULL DEFAULT 0,
+ `total_treasures` int(11) unsigned NOT NULL DEFAULT 0,
+ `player_rating` int(11) NOT NULL DEFAULT -1,
+ `timer_avg` int(11) unsigned NOT NULL DEFAULT 0,
+ `total_writeups` int(11) unsigned NOT NULL DEFAULT 0,
+ `approved_writeups` int(11) unsigned NOT NULL DEFAULT 0,
+ `finding_points` int(11) unsigned NOT NULL DEFAULT 0,
+ `treasure_points` int(11) unsigned NOT NULL DEFAULT 0,
+ `total_points` int(11) unsigned NOT NULL DEFAULT 0,
+ `on_network` smallint(6) unsigned NOT NULL DEFAULT 0,
+ `on_ondemand` smallint(6) unsigned NOT NULL DEFAULT 0,
+ `ondemand_state` smallint(6) NOT NULL DEFAULT -1,
+ PRIMARY KEY (`id`),
+ KEY `idx-target_state-total_headshots` (`total_headshots`),
+ KEY `idx-target_state-total_findings` (`total_findings`),
+ KEY `idx-target_state-total_treasures` (`total_treasures`),
+ KEY `idx-target_state-player_rating` (`player_rating`),
+ KEY `idx-target_state-timer_avg` (`timer_avg`),
+ CONSTRAINT `fk-target_states-id` FOREIGN KEY (`id`) REFERENCES `target` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `target_variable`
--
DROP TABLE IF EXISTS `target_variable`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `target_variable` (
`target_id` int(11) NOT NULL COMMENT 'Docker this variable belongs to',
- `key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Variable key (aka name)',
- `val` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Variable value',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `key` varchar(255) NOT NULL COMMENT 'Variable key (aka name)',
+ `val` varchar(255) NOT NULL COMMENT 'Variable value',
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`target_id`,`key`),
CONSTRAINT `target_variable_ibfk_1` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Docker variables';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `target_volume`
--
DROP TABLE IF EXISTS `target_volume`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `target_volume` (
`target_id` int(11) NOT NULL COMMENT 'Docker this volume belongs to',
- `volume` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Volume on host to map',
- `bind` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Bind to path within pod',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `volume` varchar(255) NOT NULL COMMENT 'Volume on host to map',
+ `bind` varchar(255) NOT NULL COMMENT 'Bind to path within pod',
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`target_id`,`volume`),
CONSTRAINT `target_volume_ibfk_1` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Docker volumes and binds';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `team`
--
DROP TABLE IF EXISTS `team`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `team` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `description` longtext COLLATE utf8mb4_unicode_ci,
- `academic` tinyint(1) DEFAULT '0',
- `logo` longblob,
+ `name` varchar(255) NOT NULL,
+ `description` longtext DEFAULT NULL,
+ `academic` tinyint(1) DEFAULT 0,
+ `logo` longblob DEFAULT NULL,
`owner_id` int(11) unsigned NOT NULL,
- `token` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `token` varchar(30) NOT NULL,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `inviteonly` tinyint(1) NOT NULL DEFAULT 1,
+ `recruitment` varchar(255) DEFAULT NULL,
+ `locked` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `token` (`token`),
KEY `owner_id` (`owner_id`),
CONSTRAINT `team_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `team_audit`
+--
+
+DROP TABLE IF EXISTS `team_audit`;
+CREATE TABLE `team_audit` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `team_id` int(11) NOT NULL,
+ `player_id` int(11) DEFAULT NULL,
+ `action` varchar(20) NOT NULL DEFAULT 'default',
+ `message` text DEFAULT NULL,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY (`id`),
+ KEY `team_id_idx` (`team_id`),
+ KEY `player_id_idx` (`player_id`),
+ KEY `action_idx` (`action`),
+ KEY `ts_idx` (`ts`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `team_invite`
+--
+
+DROP TABLE IF EXISTS `team_invite`;
+CREATE TABLE `team_invite` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `team_id` int(11) DEFAULT NULL,
+ `token` varchar(32) NOT NULL DEFAULT '',
+ `created_at` datetime DEFAULT NULL,
+ `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `token` (`token`),
+ KEY `fk_team_id` (`team_id`),
+ CONSTRAINT `fk_team_id` FOREIGN KEY (`team_id`) REFERENCES `team` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `team_player`
--
DROP TABLE IF EXISTS `team_player`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `team_player` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`team_id` int(11) NOT NULL,
`player_id` int(11) unsigned NOT NULL,
- `approved` tinyint(1) DEFAULT '0',
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `approved` tinyint(1) DEFAULT 0,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `player_id` (`player_id`),
UNIQUE KEY `team_id` (`team_id`,`player_id`),
CONSTRAINT `team_player_ibfk_1` FOREIGN KEY (`team_id`) REFERENCES `team` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `team_player_ibfk_2` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `team_rank`
+--
+
+DROP TABLE IF EXISTS `team_rank`;
+CREATE TABLE `team_rank` (
+ `id` int(11) NOT NULL DEFAULT 0,
+ `team_id` int(11) NOT NULL,
+ PRIMARY KEY (`id`,`team_id`),
+ UNIQUE KEY `team_id` (`team_id`),
+ KEY `idx-team_rank-team_id` (`team_id`)
+) ENGINE=MEMORY DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `team_score`
--
DROP TABLE IF EXISTS `team_score`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `team_score` (
`team_id` int(11) NOT NULL,
- `points` bigint(20) NOT NULL DEFAULT '0',
+ `points` bigint(20) NOT NULL DEFAULT 0,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`team_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `team_stream`
+--
+
+DROP TABLE IF EXISTS `team_stream`;
+CREATE TABLE `team_stream` (
+ `team_id` int(11) NOT NULL,
+ `model` varchar(255) NOT NULL DEFAULT '',
+ `model_id` int(11) NOT NULL DEFAULT 0,
+ `points` float NOT NULL DEFAULT 0,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY (`team_id`,`model`,`model_id`),
+ KEY `idx-team_stream-team_id` (`team_id`),
+ KEY `idx-team_stream-model` (`model`),
+ KEY `idx-team_stream-model_id` (`model_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `treasure`
--
DROP TABLE IF EXISTS `treasure`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `treasure` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `pubname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Name for the public eyes',
- `description` text COLLATE utf8mb4_unicode_ci,
- `pubdescription` text COLLATE utf8mb4_unicode_ci COMMENT 'Description for the public eyes',
+ `name` varchar(255) DEFAULT NULL,
+ `pubname` varchar(255) DEFAULT NULL COMMENT 'Name for the public eyes',
+ `description` mediumtext DEFAULT NULL,
+ `pubdescription` mediumtext DEFAULT NULL COMMENT 'Description for the public eyes',
`points` decimal(10,2) DEFAULT NULL,
- `player_type` enum('offense','defense') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'offense',
- `csum` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'If there is a file attached to this treasure',
- `appears` int(11) DEFAULT '0',
- `effects` enum('player','team','total') COLLATE utf8mb4_unicode_ci DEFAULT 'player',
- `target_id` int(11) NOT NULL DEFAULT '0' COMMENT 'A target system that this treasure is hidden on. This is not required but its good to have',
- `code` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `player_type` enum('offense','defense') NOT NULL DEFAULT 'offense',
+ `csum` varchar(128) NOT NULL DEFAULT '' COMMENT 'If there is a file attached to this treasure',
+ `appears` int(11) DEFAULT 0,
+ `effects` enum('player','team','total') DEFAULT 'player',
+ `target_id` int(11) NOT NULL DEFAULT 0 COMMENT 'A target system that this treasure is hidden on. This is not required but its good to have',
+ `code` varchar(128) DEFAULT NULL,
+ `ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `category` varchar(255) NOT NULL DEFAULT 'other',
+ `location` varchar(255) DEFAULT NULL,
+ `suggestion` mediumtext DEFAULT NULL,
+ `solution` longtext DEFAULT NULL,
+ `weight` int(11) DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`,`target_id`,`code`,`csum`),
UNIQUE KEY `code` (`code`),
KEY `target_id` (`target_id`),
+ KEY `idx-treasure-weight` (`weight`),
CONSTRAINT `treasure_ibfk_1` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Claimable points by the user, through hidden codes and files';
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `treasure_action`
--
DROP TABLE IF EXISTS `treasure_action`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `treasure_action` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`treasure_id` int(11) NOT NULL,
`ip` int(10) unsigned DEFAULT NULL,
`port` int(10) unsigned DEFAULT NULL,
- `command` text COLLATE utf8mb4_unicode_ci,
- `weight` int(11) NOT NULL DEFAULT '0',
+ `command` mediumtext DEFAULT NULL,
+ `weight` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `treasure_id` (`treasure_id`),
CONSTRAINT `treasure_action_ibfk_1` FOREIGN KEY (`treasure_id`) REFERENCES `treasure` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `tutorial`
--
DROP TABLE IF EXISTS `tutorial`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `tutorial` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `description` text COLLATE utf8mb4_unicode_ci,
+ `title` varchar(255) DEFAULT NULL,
+ `description` mediumtext DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `tutorial_target`
--
DROP TABLE IF EXISTS `tutorial_target`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `tutorial_target` (
- `tutorial_id` int(11) NOT NULL DEFAULT '0',
- `target_id` int(11) NOT NULL DEFAULT '0',
+ `tutorial_id` int(11) NOT NULL DEFAULT 0,
+ `target_id` int(11) NOT NULL DEFAULT 0,
`weight` smallint(6) DEFAULT NULL,
PRIMARY KEY (`tutorial_id`,`target_id`),
KEY `idx-tutorial_target-tutorial_id` (`tutorial_id`),
@@ -1230,79 +1753,147 @@ CREATE TABLE `tutorial_target` (
CONSTRAINT `fk-tutorial_target-target_id` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk-tutorial_target-tutorial_id` FOREIGN KEY (`tutorial_id`) REFERENCES `tutorial` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `tutorial_task`
--
DROP TABLE IF EXISTS `tutorial_task`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `tutorial_task` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tutorial_id` int(11) DEFAULT NULL,
- `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `description` text COLLATE utf8mb4_unicode_ci,
- `points` int(11) DEFAULT '0',
- `answer` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `title` varchar(255) DEFAULT NULL,
+ `description` mediumtext DEFAULT NULL,
+ `points` int(11) DEFAULT 0,
+ `answer` varchar(255) DEFAULT NULL,
`weight` smallint(6) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx-tutorial_task-tutorial_id` (`tutorial_id`),
CONSTRAINT `fk-tutorial_task-tutorial_id` FOREIGN KEY (`tutorial_id`) REFERENCES `tutorial` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `tutorial_task_dependency`
--
DROP TABLE IF EXISTS `tutorial_task_dependency`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `tutorial_task_dependency` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tutorial_task_id` int(11) DEFAULT NULL,
`item_id` int(11) NOT NULL,
- `item` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+ `item` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx-tutorial_task_dependency-tutorial_task_id` (`tutorial_task_id`),
CONSTRAINT `fk-tutorial_task_dependency-tutorial_task_id` FOREIGN KEY (`tutorial_task_id`) REFERENCES `tutorial_task` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `url_route`
+--
+
+DROP TABLE IF EXISTS `url_route`;
+CREATE TABLE `url_route` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `source` varchar(255) NOT NULL,
+ `destination` varchar(255) NOT NULL,
+ `weight` int(11) NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `source` (`source`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `auth_key` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
- `password_hash` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `password_reset_token` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `status` smallint(6) NOT NULL DEFAULT '10',
+ `username` varchar(255) NOT NULL,
+ `auth_key` varchar(32) NOT NULL,
+ `password_hash` varchar(255) NOT NULL,
+ `password_reset_token` varchar(255) DEFAULT NULL,
+ `email` varchar(255) NOT NULL,
+ `status` smallint(6) NOT NULL DEFAULT 10,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
- `verification_token` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `admin` tinyint(1) DEFAULT '1',
+ `verification_token` varchar(255) DEFAULT NULL,
+ `admin` tinyint(1) DEFAULT 1,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `password_reset_token` (`password_reset_token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+--
+-- Table structure for table `vpn_template`
+--
+DROP TABLE IF EXISTS `vpn_template`;
+CREATE TABLE `vpn_template` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) NOT NULL,
+ `client` tinyint(1) NOT NULL DEFAULT 1,
+ `server` tinyint(1) NOT NULL DEFAULT 0,
+ `active` tinyint(1) NOT NULL DEFAULT 1,
+ `visible` tinyint(1) NOT NULL DEFAULT 1,
+ `filename` varchar(255) NOT NULL DEFAULT 'echoCTF.ovpn',
+ `description` mediumtext DEFAULT NULL,
+ `content` mediumtext DEFAULT NULL,
+ `created_at` datetime DEFAULT NULL,
+ `updated_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `writeup`
+--
+
+DROP TABLE IF EXISTS `writeup`;
+CREATE TABLE `writeup` (
+ `player_id` int(11) unsigned NOT NULL,
+ `target_id` int(11) NOT NULL,
+ `content` longblob DEFAULT NULL,
+ `approved` tinyint(1) DEFAULT 0,
+ `status` enum('PENDING','NEEDS FIXES','REJECTED','OK') DEFAULT NULL,
+ `comment` longblob DEFAULT NULL,
+ `created_at` datetime DEFAULT NULL,
+ `updated_at` datetime DEFAULT NULL,
+ `formatter` varchar(255) NOT NULL DEFAULT 'text',
+ `language_id` varchar(8) NOT NULL DEFAULT 'en',
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`player_id`,`target_id`),
+ UNIQUE KEY `id` (`id`),
+ KEY `idx-writeup-player_id` (`player_id`),
+ KEY `idx-writeup-target_id` (`target_id`),
+ KEY `fk_language_id` (`language_id`),
+ CONSTRAINT `fk-writeup-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE,
+ CONSTRAINT `fk-writeup-target_id` FOREIGN KEY (`target_id`) REFERENCES `target` (`id`) ON DELETE CASCADE,
+ CONSTRAINT `fk_language_id` FOREIGN KEY (`language_id`) REFERENCES `language` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- Table structure for table `writeup_rating`
+--
+
+DROP TABLE IF EXISTS `writeup_rating`;
+CREATE TABLE `writeup_rating` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `writeup_id` int(11) NOT NULL,
+ `player_id` int(10) unsigned NOT NULL,
+ `rating` int(11) unsigned NOT NULL DEFAULT 0,
+ `created_at` datetime DEFAULT NULL,
+ `updated_at` datetime DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `writeup_id` (`writeup_id`,`player_id`),
+ KEY `idx-writeup_rating-writeup_id` (`writeup_id`),
+ KEY `idx-writeup_rating-player_id` (`player_id`),
+ CONSTRAINT `fk-writeup_rating-player_id` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE CASCADE,
+ CONSTRAINT `fk-writeup_rating-writeup_id` FOREIGN KEY (`writeup_id`) REFERENCES `writeup` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;