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 - dsn dbi:mysql:database=twittelection - user root - pass + dsn dbi:SQLite:database=data/twittelection.sqlite # dbic loader options diff --git a/docs/about/index.html b/docs/about/index.html index 49f79fe820..81dd51d689 100644 --- a/docs/about/index.html +++ b/docs/about/index.html @@ -192,5 +192,5 @@

About this site

- + diff --git a/docs/c/aberavon.html b/docs/c/aberavon.html index ff118cb8cc..9e9613c7e4 100644 --- a/docs/c/aberavon.html +++ b/docs/c/aberavon.html @@ -157,5 +157,5 @@

Aberavon

- + diff --git a/docs/c/aberconwy.html b/docs/c/aberconwy.html index b4236f92c4..b66a1167cf 100644 --- a/docs/c/aberconwy.html +++ b/docs/c/aberconwy.html @@ -151,5 +151,5 @@

Aberconwy

- + diff --git a/docs/c/aberdeen-north.html b/docs/c/aberdeen-north.html index 6689f4d222..bea5c2a567 100644 --- a/docs/c/aberdeen-north.html +++ b/docs/c/aberdeen-north.html @@ -153,5 +153,5 @@

Aberdeen North

- + diff --git a/docs/c/aberdeen-south.html b/docs/c/aberdeen-south.html index 788d296e0e..51641b0828 100644 --- a/docs/c/aberdeen-south.html +++ b/docs/c/aberdeen-south.html @@ -154,5 +154,5 @@

Aberdeen South

- + diff --git a/docs/c/airdrie-and-shotts.html b/docs/c/airdrie-and-shotts.html index 6b2514821a..e5816623cf 100644 --- a/docs/c/airdrie-and-shotts.html +++ b/docs/c/airdrie-and-shotts.html @@ -155,5 +155,5 @@

Airdrie and Shotts

- + diff --git a/docs/c/aldershot.html b/docs/c/aldershot.html index 71e6861664..0f011885f3 100644 --- a/docs/c/aldershot.html +++ b/docs/c/aldershot.html @@ -151,5 +151,5 @@

Aldershot

- + diff --git a/docs/c/aldridge-brownhills.html b/docs/c/aldridge-brownhills.html index 5c22d3319e..c3d9e43974 100644 --- a/docs/c/aldridge-brownhills.html +++ b/docs/c/aldridge-brownhills.html @@ -155,5 +155,5 @@

Aldridge-Brownhills

- + diff --git a/docs/c/altrincham-and-sale-west.html b/docs/c/altrincham-and-sale-west.html index cf619427d7..03c1a080d9 100644 --- a/docs/c/altrincham-and-sale-west.html +++ b/docs/c/altrincham-and-sale-west.html @@ -153,5 +153,5 @@

Altrincham and Sale West

- + diff --git a/docs/c/alyn-and-deeside.html b/docs/c/alyn-and-deeside.html index 31c2138f5c..db37af7d08 100644 --- a/docs/c/alyn-and-deeside.html +++ b/docs/c/alyn-and-deeside.html @@ -155,5 +155,5 @@

Alyn and Deeside

- + diff --git a/docs/c/amber-valley.html b/docs/c/amber-valley.html index 16b9d1216b..69115be362 100644 --- a/docs/c/amber-valley.html +++ b/docs/c/amber-valley.html @@ -154,5 +154,5 @@

Amber Valley

- + diff --git a/docs/c/angus.html b/docs/c/angus.html index c03bdaad0a..f8c366ee8e 100644 --- a/docs/c/angus.html +++ b/docs/c/angus.html @@ -154,5 +154,5 @@

Angus

- + diff --git a/docs/c/arfon.html b/docs/c/arfon.html index 03189993f3..ff04a9f259 100644 --- a/docs/c/arfon.html +++ b/docs/c/arfon.html @@ -154,5 +154,5 @@

Arfon

- + diff --git a/docs/c/argyll-and-bute.html b/docs/c/argyll-and-bute.html index e67895b99b..a1b791515b 100644 --- a/docs/c/argyll-and-bute.html +++ b/docs/c/argyll-and-bute.html @@ -154,5 +154,5 @@

Argyll and Bute

- + diff --git a/docs/c/arundel-and-south-downs.html b/docs/c/arundel-and-south-downs.html index 21a98ec119..84c837ca14 100644 --- a/docs/c/arundel-and-south-downs.html +++ b/docs/c/arundel-and-south-downs.html @@ -152,5 +152,5 @@

Arundel and South Downs

- + diff --git a/docs/c/ashfield.html b/docs/c/ashfield.html index b369651e23..4b58fcc7d4 100644 --- a/docs/c/ashfield.html +++ b/docs/c/ashfield.html @@ -156,5 +156,5 @@

Ashfield

- + diff --git a/docs/c/ashford.html b/docs/c/ashford.html index fbda156f0e..958ded019f 100644 --- a/docs/c/ashford.html +++ b/docs/c/ashford.html @@ -155,5 +155,5 @@

Ashford

- + diff --git a/docs/c/ashton-under-lyne.html b/docs/c/ashton-under-lyne.html index 2d513a7f45..e2169da311 100644 --- a/docs/c/ashton-under-lyne.html +++ b/docs/c/ashton-under-lyne.html @@ -152,5 +152,5 @@

Ashton-under-Lyne

- + diff --git a/docs/c/aylesbury.html b/docs/c/aylesbury.html index f392704b83..3a355c78b6 100644 --- a/docs/c/aylesbury.html +++ b/docs/c/aylesbury.html @@ -151,5 +151,5 @@

Aylesbury

- + diff --git a/docs/c/ayr-carrick-and-cumnock.html b/docs/c/ayr-carrick-and-cumnock.html index fd44e83d0d..19cbe7d8b2 100644 --- a/docs/c/ayr-carrick-and-cumnock.html +++ b/docs/c/ayr-carrick-and-cumnock.html @@ -154,5 +154,5 @@

Ayr, Carrick and Cumnock

- + diff --git a/docs/c/banbury.html b/docs/c/banbury.html index e528c49e0e..eaa73f858f 100644 --- a/docs/c/banbury.html +++ b/docs/c/banbury.html @@ -151,5 +151,5 @@

Banbury

- + diff --git a/docs/c/banff-and-buchan.html b/docs/c/banff-and-buchan.html index 0e817d3989..b27c5a2c67 100644 --- a/docs/c/banff-and-buchan.html +++ b/docs/c/banff-and-buchan.html @@ -151,5 +151,5 @@

Banff and Buchan

- + diff --git a/docs/c/barking.html b/docs/c/barking.html index dcd75042fd..64b1fc21fc 100644 --- a/docs/c/barking.html +++ b/docs/c/barking.html @@ -155,5 +155,5 @@

Barking

- + diff --git a/docs/c/barnsley-central.html b/docs/c/barnsley-central.html index a9d288c52f..a9351108a5 100644 --- a/docs/c/barnsley-central.html +++ b/docs/c/barnsley-central.html @@ -157,5 +157,5 @@

Barnsley Central

- + diff --git a/docs/c/barnsley-east.html b/docs/c/barnsley-east.html index 17f86c9853..52927ea36e 100644 --- a/docs/c/barnsley-east.html +++ b/docs/c/barnsley-east.html @@ -155,5 +155,5 @@

Barnsley East

- + diff --git a/docs/c/barrow-and-furness.html b/docs/c/barrow-and-furness.html index a1c576cd4d..d614a6508a 100644 --- a/docs/c/barrow-and-furness.html +++ b/docs/c/barrow-and-furness.html @@ -152,5 +152,5 @@

Barrow and Furness

- + diff --git a/docs/c/basildon-and-billericay.html b/docs/c/basildon-and-billericay.html index f96717b2bc..c4de90e334 100644 --- a/docs/c/basildon-and-billericay.html +++ b/docs/c/basildon-and-billericay.html @@ -155,5 +155,5 @@

Basildon and Billericay

- + diff --git a/docs/c/basingstoke.html b/docs/c/basingstoke.html index 1bae50a5b4..55223cf0fc 100644 --- a/docs/c/basingstoke.html +++ b/docs/c/basingstoke.html @@ -155,5 +155,5 @@

Basingstoke

- + diff --git a/docs/c/bassetlaw.html b/docs/c/bassetlaw.html index 9acdd3bd92..bb35d58c4f 100644 --- a/docs/c/bassetlaw.html +++ b/docs/c/bassetlaw.html @@ -154,5 +154,5 @@

Bassetlaw

- + diff --git a/docs/c/bath.html b/docs/c/bath.html index 488bdc5ef8..45cdac922d 100644 --- a/docs/c/bath.html +++ b/docs/c/bath.html @@ -152,5 +152,5 @@

Bath

- + diff --git a/docs/c/batley-and-spen.html b/docs/c/batley-and-spen.html index 87e6e81ef8..f3157203e5 100644 --- a/docs/c/batley-and-spen.html +++ b/docs/c/batley-and-spen.html @@ -156,5 +156,5 @@

Batley and Spen

- + diff --git a/docs/c/battersea.html b/docs/c/battersea.html index e3223a17f8..edb8d2b457 100644 --- a/docs/c/battersea.html +++ b/docs/c/battersea.html @@ -152,5 +152,5 @@

Battersea

- + diff --git a/docs/c/beaconsfield.html b/docs/c/beaconsfield.html index e4a1bbf315..e36e415e06 100644 --- a/docs/c/beaconsfield.html +++ b/docs/c/beaconsfield.html @@ -152,5 +152,5 @@

Beaconsfield

- + diff --git a/docs/c/beckenham.html b/docs/c/beckenham.html index 66a5b49fbb..e8f9dd32fb 100644 --- a/docs/c/beckenham.html +++ b/docs/c/beckenham.html @@ -151,5 +151,5 @@

Beckenham

- + diff --git a/docs/c/bedford.html b/docs/c/bedford.html index a66fd9c45d..3b4d730452 100644 --- a/docs/c/bedford.html +++ b/docs/c/bedford.html @@ -155,5 +155,5 @@

Bedford

- + diff --git a/docs/c/belfast-east.html b/docs/c/belfast-east.html index 206d0c913f..aeb9985f03 100644 --- a/docs/c/belfast-east.html +++ b/docs/c/belfast-east.html @@ -150,5 +150,5 @@

Belfast East

- + diff --git a/docs/c/belfast-north.html b/docs/c/belfast-north.html index 23c91f657c..112562cef0 100644 --- a/docs/c/belfast-north.html +++ b/docs/c/belfast-north.html @@ -95,7 +95,7 @@

Belfast North

election.

Tweeting Candidates @@ -150,5 +150,5 @@

Belfast North

- + diff --git a/docs/c/belfast-south.html b/docs/c/belfast-south.html index 99af18c662..85ebf63090 100644 --- a/docs/c/belfast-south.html +++ b/docs/c/belfast-south.html @@ -98,7 +98,7 @@

Belfast South

  • Paula Bradshaw (Alliance - Alliance Party of Northern Ireland)
    @PaulaJaneB
  • Claire Hanna (SDLP (Social Democratic & Labour Party))
    @ClaireHanna
  • Emma Little-Pengelly (Democratic Unionist Party - D.U.P.)
    @little_pengelly
  • -
  • Chris McHugh (Aontú)
    @CAontu
  • +
  • Chris McHugh (Aontú)
    @CAontu
  • Non-Tweeting Candidates