diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ae8fab4e05..c058d23aab 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -23,6 +23,7 @@ jobs:
- name: Create pages
env:
PERL5LIB: lib
+ TE_DB_FILE: data/twittelection.sqlite
run: |
bin/build
diff --git a/bin/build b/bin/build
index c9fc60c4aa..76f2004f5c 100755
--- a/bin/build
+++ b/bin/build
@@ -5,6 +5,8 @@ use warnings;
use 5.010;
use lib 'lib';
+use open ':std', IO => ':encoding(UTF-8)';
+
use TwittElection::App;
my $te_app = TwittElection::App->new;
diff --git a/bin/dump_ddl b/bin/dump_ddl
new file mode 100755
index 0000000000..678164a5d5
--- /dev/null
+++ b/bin/dump_ddl
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+dir=$(dirname "$0")
+# shellcheck disable=SC1091
+. "$dir/func_defs"
+
+check_vars
+
+echo Dumping database DDL
+mysqldump --skip-extended-insert -d \
+ -h"$TE_DB_HOST" \
+ -P"${TE_PORT:-3306}" \
+ -u"$TE_DB_USER" \
+ -p"$TE_DB_PASS" \
+ "$TE_DB_NAME" > data/twittelection_ddl.sql
diff --git a/data/twittelection.sqlite b/data/twittelection.sqlite
new file mode 100644
index 0000000000..02cfea31c7
Binary files /dev/null and b/data/twittelection.sqlite differ
diff --git a/data/twittelection_sqlite_ddl.sql b/data/twittelection_sqlite_ddl.sql
new file mode 100644
index 0000000000..bd82c8734f
--- /dev/null
+++ b/data/twittelection_sqlite_ddl.sql
@@ -0,0 +1,62 @@
+--
+-- Created by SQL::Translator::Producer::SQLite
+-- Created on Sat Apr 20 15:26:29 2024
+--
+
+BEGIN TRANSACTION;
+
+--
+-- Table: "candidate"
+--
+CREATE TABLE "candidate" (
+ "id" INTEGER PRIMARY KEY NOT NULL,
+ "yournextmp_id" int(11) NOT NULL,
+ "name" varchar(200) NOT NULL,
+ "twitter" varchar(200) DEFAULT NULL,
+ "party_id" int(11) NOT NULL,
+ "constituency_id" int(11) DEFAULT NULL,
+ "current_mp" int(11) NOT NULL DEFAULT 0,
+ "twitter_problem" smallint(6) NOT NULL DEFAULT 0,
+ FOREIGN KEY ("party_id") REFERENCES "party"("id"),
+ FOREIGN KEY ("constituency_id") REFERENCES "constituency"("id")
+);
+
+CREATE INDEX "party_id" ON "candidate" ("party_id");
+
+CREATE INDEX "constituency_id" ON "candidate" ("constituency_id");
+
+CREATE UNIQUE INDEX "yournextmp_id" ON "candidate" ("yournextmp_id");
+
+--
+-- Table: "constituency"
+--
+CREATE TABLE "constituency" (
+ "id" INTEGER PRIMARY KEY NOT NULL,
+ "mapit_id" int(11) NOT NULL DEFAULT 0,
+ "demclub_id" varchar(20) DEFAULT NULL,
+ "name" varchar(200) NOT NULL,
+ "list_name" varchar(25) NOT NULL,
+ "list_id" varchar(20) DEFAULT NULL,
+ "candidates_updated_time" datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
+ "list_rebuilt_time" datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
+ "list_checked_time" datetime DEFAULT NULL
+);
+
+CREATE UNIQUE INDEX "mapit_id" ON "constituency" ("mapit_id");
+
+--
+-- Table: "party"
+--
+CREATE TABLE "party" (
+ "id" INTEGER PRIMARY KEY NOT NULL,
+ "yournextmp_id" int(11) NOT NULL,
+ "name" varchar(200) NOT NULL,
+ "list_name" varchar(25) NOT NULL DEFAULT '',
+ "list_id" varchar(20) DEFAULT NULL,
+ "candidates_updated_time" datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
+ "list_rebuilt_time" datetime NOT NULL DEFAULT '2000-01-01 00:00:00'
+);
+
+CREATE UNIQUE INDEX "yournextmp_id02" ON "party" ("yournextmp_id");
+
+COMMIT;
diff --git a/db/dbic.conf b/db/dbic.conf
index 3e53a59260..5bd31a4880 100644
--- a/db/dbic.conf
+++ b/db/dbic.conf
@@ -4,9 +4,7 @@ lib lib
# connection string