Skip to content

Commit

Permalink
Start to switch to SQLite
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Apr 20, 2024
1 parent 62f6531 commit c97080b
Show file tree
Hide file tree
Showing 739 changed files with 967 additions and 859 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Expand Up @@ -23,6 +23,7 @@ jobs:
- name: Create pages
env:
PERL5LIB: lib
TE_DB_FILE: data/twittelection.sqlite
run: |
bin/build
Expand Down
2 changes: 2 additions & 0 deletions bin/build
Expand Up @@ -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;
Expand Down
15 changes: 15 additions & 0 deletions 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
Binary file added data/twittelection.sqlite
Binary file not shown.
62 changes: 62 additions & 0 deletions 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;
4 changes: 1 addition & 3 deletions db/dbic.conf
Expand Up @@ -4,9 +4,7 @@ lib lib

# connection string
<connect_info>
dsn dbi:mysql:database=twittelection
user root
pass
dsn dbi:SQLite:database=data/twittelection.sqlite
</connect_info>

# dbic loader options
Expand Down
2 changes: 1 addition & 1 deletion docs/about/index.html
Expand Up @@ -192,5 +192,5 @@ <h1>About this site</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:44:20 19-Apr-2024 -->
<!-- Built at: 16:18:30 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/aberavon.html
Expand Up @@ -157,5 +157,5 @@ <h1>Aberavon</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/aberconwy.html
Expand Up @@ -151,5 +151,5 @@ <h1>Aberconwy</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/aberdeen-north.html
Expand Up @@ -153,5 +153,5 @@ <h1>Aberdeen North</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/aberdeen-south.html
Expand Up @@ -154,5 +154,5 @@ <h1>Aberdeen South</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/airdrie-and-shotts.html
Expand Up @@ -155,5 +155,5 @@ <h1>Airdrie and Shotts</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/aldershot.html
Expand Up @@ -151,5 +151,5 @@ <h1>Aldershot</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/aldridge-brownhills.html
Expand Up @@ -155,5 +155,5 @@ <h1>Aldridge-Brownhills</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/altrincham-and-sale-west.html
Expand Up @@ -153,5 +153,5 @@ <h1>Altrincham and Sale West</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/alyn-and-deeside.html
Expand Up @@ -155,5 +155,5 @@ <h1>Alyn and Deeside</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/amber-valley.html
Expand Up @@ -154,5 +154,5 @@ <h1>Amber Valley</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/angus.html
Expand Up @@ -154,5 +154,5 @@ <h1>Angus</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/arfon.html
Expand Up @@ -154,5 +154,5 @@ <h1>Arfon</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/argyll-and-bute.html
Expand Up @@ -154,5 +154,5 @@ <h1>Argyll and Bute</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/arundel-and-south-downs.html
Expand Up @@ -152,5 +152,5 @@ <h1>Arundel and South Downs</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/ashfield.html
Expand Up @@ -156,5 +156,5 @@ <h1>Ashfield</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/ashford.html
Expand Up @@ -155,5 +155,5 @@ <h1>Ashford</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/ashton-under-lyne.html
Expand Up @@ -152,5 +152,5 @@ <h1>Ashton-under-Lyne</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/aylesbury.html
Expand Up @@ -151,5 +151,5 @@ <h1>Aylesbury</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/ayr-carrick-and-cumnock.html
Expand Up @@ -154,5 +154,5 @@ <h1>Ayr, Carrick and Cumnock</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/banbury.html
Expand Up @@ -151,5 +151,5 @@ <h1>Banbury</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/banff-and-buchan.html
Expand Up @@ -151,5 +151,5 @@ <h1>Banff and Buchan</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/barking.html
Expand Up @@ -155,5 +155,5 @@ <h1>Barking</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:40 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/barnsley-central.html
Expand Up @@ -157,5 +157,5 @@ <h1>Barnsley Central</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/barnsley-east.html
Expand Up @@ -155,5 +155,5 @@ <h1>Barnsley East</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/barrow-and-furness.html
Expand Up @@ -152,5 +152,5 @@ <h1>Barrow and Furness</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/basildon-and-billericay.html
Expand Up @@ -155,5 +155,5 @@ <h1>Basildon and Billericay</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/basingstoke.html
Expand Up @@ -155,5 +155,5 @@ <h1>Basingstoke</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/bassetlaw.html
Expand Up @@ -154,5 +154,5 @@ <h1>Bassetlaw</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/bath.html
Expand Up @@ -152,5 +152,5 @@ <h1>Bath</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/batley-and-spen.html
Expand Up @@ -156,5 +156,5 @@ <h1>Batley and Spen</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/battersea.html
Expand Up @@ -152,5 +152,5 @@ <h1>Battersea</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/beaconsfield.html
Expand Up @@ -152,5 +152,5 @@ <h1>Beaconsfield</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/beckenham.html
Expand Up @@ -151,5 +151,5 @@ <h1>Beckenham</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/bedford.html
Expand Up @@ -155,5 +155,5 @@ <h1>Bedford</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
2 changes: 1 addition & 1 deletion docs/c/belfast-east.html
Expand Up @@ -150,5 +150,5 @@ <h1>Belfast East</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
4 changes: 2 additions & 2 deletions docs/c/belfast-north.html
Expand Up @@ -95,7 +95,7 @@ <h1>Belfast North</h1>
election.</p>
<b>Tweeting Candidates</b>
<ul>
<li>John Finucane (<a href="/p/sinn-féin.html">Sinn Féin</a>)<br><a href="https://twitter.com/johnfinucane">@johnfinucane</a></li>
<li>John Finucane (<a href="/p/sinn-f-in.html">Sinn Féin</a>)<br><a href="https://twitter.com/johnfinucane">@johnfinucane</a></li>
<li>Nuala McAllister (<a href="/p/alliance-alliance-party-of-northern-ireland.html">Alliance - Alliance Party of Northern Ireland</a>)<br><a href="https://twitter.com/NualaMcAllister">@NualaMcAllister</a></li>
<li>Nigel Dodds (<a href="/p/democratic-unionist-party-d-u-p-.html">Democratic Unionist Party - D.U.P.</a>)<br><a href="https://twitter.com/NigelDoddsDUP">@NigelDoddsDUP</a></li>
</ul>
Expand Down Expand Up @@ -150,5 +150,5 @@ <h1>Belfast North</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>
4 changes: 2 additions & 2 deletions docs/c/belfast-south.html
Expand Up @@ -98,7 +98,7 @@ <h1>Belfast South</h1>
<li>Paula Bradshaw (<a href="/p/alliance-alliance-party-of-northern-ireland.html">Alliance - Alliance Party of Northern Ireland</a>)<br><a href="https://twitter.com/PaulaJaneB">@PaulaJaneB</a></li>
<li>Claire Hanna (<a href="/p/sdlp-social-democratic-labour-party-.html">SDLP (Social Democratic & Labour Party)</a>)<br><a href="https://twitter.com/ClaireHanna">@ClaireHanna</a></li>
<li>Emma Little-Pengelly (<a href="/p/democratic-unionist-party-d-u-p-.html">Democratic Unionist Party - D.U.P.</a>)<br><a href="https://twitter.com/little_pengelly">@little_pengelly</a></li>
<li>Chris McHugh (<a href="/p/aontú.html">Aontú</a>)<br><a href="https://twitter.com/CAontu">@CAontu</a></li>
<li>Chris McHugh (<a href="/p/aont-.html">Aontú</a>)<br><a href="https://twitter.com/CAontu">@CAontu</a></li>
</ul>
<b>Non-Tweeting Candidates</b>
<ul>
Expand Down Expand Up @@ -155,5 +155,5 @@ <h1>Belfast South</h1>
<script src="/js/main.js"></script>

</body>
<!-- Built at: 12:43:41 19-Apr-2024 -->
<!-- Built at: 16:18:14 20-Apr-2024 -->
</html>

0 comments on commit c97080b

Please sign in to comment.