Add initial Plenario live polling app
CI / Deploy / test (push) Successful in 49s
CI / Deploy / deploy (push) Failing after 5s

CakePHP 5.4 app for live polls: create via email without login, manage
via secret admin link, join via code. Includes slide types (choice,
wordcloud, open, scale, content), presenter mode, CSV export, captcha,
throttling, tests and Gitea CI/deploy workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-07 13:24:29 +01:00
commit eb319f8c1e
120 files changed
+15572

No files matched your search

@@ -0,0 +1,79 @@
<?php
declare(strict_types=1);
use Migrations\BaseMigration;
/**
* Initial Plenario schema.
*
* polls - one "presentation" created via e-mail, managed through a secret admin link
* slides - questions / content slides of a poll, ordered by `position`
* slide_options - answer options for choice slides
* responses - participant answers (one row per selected option / entered text / value)
*/
class CreateInitialSchema extends BaseMigration
{
/**
* @return void
*/
public function change(): void
{
$this->table('polls')
->addColumn('title', 'string', ['limit' => 200, 'null' => false])
->addColumn('email', 'string', ['limit' => 255, 'null' => false])
// sha256 of the secret admin token; the token itself is only sent by mail
->addColumn('admin_token_hash', 'string', ['limit' => 64, 'null' => false])
// token encrypted with Security.salt so the recovery mail can resend the same link
->addColumn('admin_token_encrypted', 'text', ['null' => false])
// short public code participants use to join, e.g. "K7P2QX"
->addColumn('join_code', 'string', ['limit' => 12, 'null' => false])
->addColumn('current_slide_id', 'integer', ['null' => true, 'default' => null])
->addColumn('is_active', 'boolean', ['null' => false, 'default' => true])
->addColumn('show_results_to_participants', 'boolean', ['null' => false, 'default' => true])
->addColumn('last_admin_access', 'datetime', ['null' => true, 'default' => null])
->addColumn('created', 'datetime', ['null' => false])
->addColumn('modified', 'datetime', ['null' => false])
->addIndex(['admin_token_hash'], ['unique' => true])
->addIndex(['join_code'], ['unique' => true])
->addIndex(['email'])
->create();
$this->table('slides')
->addColumn('poll_id', 'integer', ['null' => false])
// choice | wordcloud | open | scale | content
->addColumn('type', 'string', ['limit' => 20, 'null' => false])
->addColumn('question', 'string', ['limit' => 500, 'null' => false])
->addColumn('description', 'text', ['null' => true, 'default' => null])
->addColumn('position', 'integer', ['null' => false, 'default' => 0])
// JSON encoded type specific settings (multiple, scale_min, scale_max, ...)
->addColumn('settings', 'text', ['null' => true, 'default' => null])
->addColumn('is_voting_open', 'boolean', ['null' => false, 'default' => true])
->addColumn('created', 'datetime', ['null' => false])
->addColumn('modified', 'datetime', ['null' => false])
->addIndex(['poll_id', 'position'])
->addForeignKey('poll_id', 'polls', 'id', ['delete' => 'CASCADE', 'update' => 'NO_ACTION'])
->create();
$this->table('slide_options')
->addColumn('slide_id', 'integer', ['null' => false])
->addColumn('label', 'string', ['limit' => 255, 'null' => false])
->addColumn('position', 'integer', ['null' => false, 'default' => 0])
->addIndex(['slide_id', 'position'])
->addForeignKey('slide_id', 'slides', 'id', ['delete' => 'CASCADE', 'update' => 'NO_ACTION'])
->create();
$this->table('responses')
->addColumn('slide_id', 'integer', ['null' => false])
// sha256 of the participant cookie id - anonymous, only used to prevent double voting
->addColumn('participant_hash', 'string', ['limit' => 64, 'null' => false])
->addColumn('slide_option_id', 'integer', ['null' => true, 'default' => null])
->addColumn('text_value', 'string', ['limit' => 500, 'null' => true, 'default' => null])
->addColumn('numeric_value', 'integer', ['null' => true, 'default' => null])
->addColumn('created', 'datetime', ['null' => false])
->addIndex(['slide_id', 'participant_hash'])
->addIndex(['slide_option_id'])
->addForeignKey('slide_id', 'slides', 'id', ['delete' => 'CASCADE', 'update' => 'NO_ACTION'])
->addForeignKey('slide_option_id', 'slide_options', 'id', ['delete' => 'CASCADE', 'update' => 'NO_ACTION'])
->create();
}
}