Move symfony stuff to own folder

This commit is contained in:
2025-05-28 23:51:27 +01:00
parent 20e604cf68
commit 077d33d801
89 changed files with 24 additions and 26 deletions

0
symfony/migrations/.gitignore vendored Normal file
View File

View File

@@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250517200832 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
CREATE TABLE note (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, content VARCHAR(255) NOT NULL, published_date DATE NOT NULL)
SQL);
$this->addSql(<<<'SQL'
CREATE TABLE messenger_messages (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, body CLOB NOT NULL, headers CLOB NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
, available_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
, delivered_at DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
)
SQL);
$this->addSql(<<<'SQL'
CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)
SQL);
$this->addSql(<<<'SQL'
CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)
SQL);
$this->addSql(<<<'SQL'
CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)
SQL);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
DROP TABLE note
SQL);
$this->addSql(<<<'SQL'
DROP TABLE messenger_messages
SQL);
}
}

View File

@@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250517212750 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
ALTER TABLE note ADD COLUMN slug VARCHAR(255) NOT NULL
SQL);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
CREATE TEMPORARY TABLE __temp__note AS SELECT id, content, published_date FROM note
SQL);
$this->addSql(<<<'SQL'
DROP TABLE note
SQL);
$this->addSql(<<<'SQL'
CREATE TABLE note (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, content VARCHAR(255) NOT NULL, published_date DATE NOT NULL)
SQL);
$this->addSql(<<<'SQL'
INSERT INTO note (id, content, published_date) SELECT id, content, published_date FROM __temp__note
SQL);
$this->addSql(<<<'SQL'
DROP TABLE __temp__note
SQL);
}
}

View File

@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20250519215136 extends AbstractMigration
{
public function getDescription(): string {
return '';
}
public function up(Schema $schema): void {}
public function down(Schema $schema): void {}
}

View File

@@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20250521000000 extends AbstractMigration
{
public function getDescription(): string {
return 'Migrating my links from my old website to notes in my new website';
}
public function up(Schema $schema): void {
$this->addSql(<<<'SQL'
INSERT INTO note(content, published_date, slug) VALUES
('[Is Stack Overflow Obsolete? An Empirical Study of the Characteristics of ChatGPT Answers to Stack Overflow Questions](https://dl.acm.org/doi/pdf/10.1145/3613904.3642596). ChatGPT 3.5 gives bad answers half the time, and programmers miss the mistakes almost half the time. Be careful out there, folks.', '2024-06-04', '2024-06-04'),
('[Primary and Secondary Values](https://www.colinmcginn.net/primary-and-secondary-values). Colin McGinn makes the case for primary and secondary moral values, just as there are primary and secondary qualities, apparently thereby managing to assert both moral realism and anti-realism at the same time without contradiction.', '2024-06-05', '2024-06-05'),
('[Pluralistic: They brick you because they can](https://pluralistic.net/2024/05/24/record-scratch/#autoenshittification). Cory Doctorow writes incessantly about the harms of monopolised markets. This essay is particularly good, because he collects many of monopolists greatest hits from recent years. Do keep reading to the end. It just gets better.', '2024-06-05', '2024-06-05-1'),
('[Parenting](https://johan.hal.se/wrote/2024/06/05/parenting). Once you find yourself in the position of being someones father youll quickly realize that youre not actually raising anyone here, you just happen to be the veteran in the trenches alongside them, showing them the ropes and hoping theyll survive and turn out okay.', '2024-06-05', '2024-06-05-2'),
('[Boys](https://www.bbc.co.uk/programmes/m001yshl). Catherine Carr did a fantastic job of unveiling how teenage boys are experiencing masculinity in Britain today. Plenty here to surprise, shock and inspire.', '2024-06-05', '2024-06-05-3'),
('[BCS manifesto](https://www.bcs.org/articles-opinion-and-research/the-computing-revolution-how-the-next-government-can-transform-society-with-ethics-education-and-equity-in-technology). Good for what it is. Good policies. Succinct. Should be the beginning (<em>not</em> the end) of some interesting conversations.', '2024-06-05', '2024-06-05-4'),
('[154 McDonald Road: Gone but not Forgotten](https://broughtonspurtle.org.uk/news/gone-not-forgotten). A superb tribute to the building and analysis of the failures of the planning system. This was published in my free local newsletter, and is worthy of any broadsheet newspaper.', '2024-06-07', '2024-06-07'),
('[Beware the cloud of hype](https://thehistoryoftheweb.com/beware-the-cloud-of-hype). Jay Hoffman spots some striking parallels between the current AI hype and the dot-com bubble.', '2024-06-07', '2024-06-07-1'),
('[Saving the News from Big Tech](https://eff.org/saving-the-news). Cory Doctorow, writing for the Electronic Frontier Foundation, argues that to save news media, we need to dismantle ad-tech monopolies, ban surveillance advertising, open up app stores and have an end-to-end web.', '2024-06-07', '2024-06-07-2'),
('[Instagram is training AI on your data. Its nearly impossible to opt out](https://www.fastcompany.com/91132854/instagram-training-ai-on-your-data-its-nearly-impossible-to-opt-out). Yuck, yuck, yuck. Makes me glad Im not on Instagram. For people already stuck there, though, this just sucks. Highly recommend either opting out of AI training or quitting Insta, if only to give the twits the middle finger they deserve.', '2024-06-14', '2024-06-14'),
('[State-based UI is an anti-pattern](https://gomakethings.com/state-based-ui-is-an-anti-pattern). Chris Ferdinandi has a hot take here. I would be keen to test this idea out one day: push the limits of how much complex state you can manage within the light DOM.', '2024-06-14', '2024-06-14-1'),
('[Big Data is Dead](https://motherduck.com/blog/big-data-is-dead). Did you know that most organisations store less than 100GB, and almost all analytics is run on the last 24h of data? I didnt. Though take it all with a pinch of salt: the guys writing on his company blog which sells traditional data warehouses.', '2024-06-17', '2024-06-17'),
('[Reverse Engineering TicketMaster''s Rotating Barcodes (SafeTix)](https://conduition.io/coding/ticketmaster). Who doesn''t like a classic David-and-Goliath hacker story? Also, if you''re American, please <a href="https://www.breakupticketmaster.com">break up TicketMaster</a>. If you''re in the UK, it''s not quite as bad, but <a href="https://assets.publishing.service.gov.uk/media/5519473540f0b61401000087/final_report.pdf">it''s still really bad</a>. Use alternatives where you can.', '2024-07-16', '2024-07-16'),
('[Dont use booleans](https://www.luu.io/posts/dont-use-booleans). A nice idea. But I think this advice only applies well when you''ve got many inter-dependent flags. If you have independent flags, re-writing those as enums will just end up with you re-implementing the boolean type for every parameter, and not getting much profit, I reckon.', '2024-07-16', '2024-07-16-1'),
('[Story points are wasting time](https://blog.scottlogic.com/2024/07/05/story-points-are-wasting-time.html). Pretty convincing to me. The biggest potential weakness in his argument is his claim that none of the most common reasons why devs disagree on story points exposes anything which ought to be resolved in an estimation meeting. If you can provide other common reasons besides the ones Dave considered, you could rebut his argument. I don''t feel experienced enough to judge this myself.', '2024-07-17', '2024-07-17'),
('[Goldman Sachs Top of the Mind, Issue 129](https://www.goldmansachs.com/intelligence/pages/gs-research/gen-ai-too-much-spend-too-little-benefit/report.pdf). Read the interviews. Economists give interesting, and diverse, opinions on the economic potential of LLMs.', '2024-07-18', '2024-07-18'),
('[The Human Cost Of Our AI-Driven Future](https://www.noemamag.com/the-human-cost-of-our-ai-driven-future). In case you''d forgotten: content moderation is still carried out by appalling worker exploitation. This is not news, but nonetheless an excellent and suitably chilling essay on the topic. Be aware that the essay describes some deeply traumatic content.', '2024-10-11', '2024-10-11'),
('[LLMs don''t ''hallucinate''](https://blog.scottlogic.com/2024/09/10/llms-dont-hallucinate.html). I posted on the Scott Logic blog a while ago about how the word ''hallucination'' doesn''t accurately capture how LLMs work.', '2024-10-11', '2024-10-11-1'),
('[Please just stop saying ''just''](https://sgringwe.com/2019/10/10/Please-just-stop-saying-just.html). A pretty good case for avoiding the word ''just'' in software engineering. I admit I''ve been guilty, too.', '2024-11-11', '2024-11-11'),
('[Sexual symmetry and asymmetry](https://alexanderpruss.blogspot.com/2024/11/sexual-symmetry-and-asymmetry.html). Alexander Pruss has a bizarre, but at first blush convincing, argument that complementarians about gender dont have to appeal to morally significant intrinsic differences between men and women.', '2024-12-17', '2024-12-17'),
('["Rules" that terminal programs follow](https://jvns.ca/blog/2024/11/26/terminal-rules). Handy for the next time you develop a CLI or TUI. Also handy as a user: now I know about <a href="https://readline.kablamo.org/emacs.html">readline key bindings</a>, which are everywhere apparently.', '2024-12-20', '2024-12-20'),
('[Bank of England''s ''Millenium of Macroeconomic Data''](https://www.bankofengland.co.uk/statistics/research-datasets). There was no long-term price inflation from 1200 (when these data begin) until 1550. WHAT?!', '2025-01-23', '2025-01-23'),
('[Free social media from billionaire control](https://freeourfeeds.com). I just donated $40. These guys are promising to do whatever it takes to make sure the AT Protocol is genuinely owned by everyone.', '2025-01-28', '2025-01-28')
SQL);
}
public function down(Schema $schema): void {
$this->addSql(<<<'SQL'
DELETE FROM note WHERE
slug = '2024-06-04' OR
slug = '2024-06-05' OR
slug = '2024-06-05-1' OR
slug = '2024-06-05-2' OR
slug = '2024-06-05-3' OR
slug = '2024-06-05-4' OR
slug = '2024-06-07' OR
slug = '2024-06-07-1' OR
slug = '2024-06-07-2' OR
slug = '2024-06-14' OR
slug = '2024-06-14-1' OR
slug = '2024-06-17' OR
slug = '2024-07-16' OR
slug = '2024-07-16-1' OR
slug = '2024-07-17' OR
slug = '2024-07-18' OR
slug = '2024-10-11' OR
slug = '2024-10-11-1' OR
slug = '2024-11-11' OR
slug = '2024-12-17' OR
slug = '2024-12-20' OR
slug = '2025-01-23' OR
slug = '2025-01-28'
SQL);
}
}

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250522212213 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
CREATE TABLE blog_post (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, slug VARCHAR(255) NOT NULL, published_date DATE NOT NULL, updated_date DATE DEFAULT NULL, content CLOB NOT NULL, title VARCHAR(255) NOT NULL, description VARCHAR(1024) NOT NULL)
SQL);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
DROP TABLE blog_post
SQL);
}
}

View File

@@ -0,0 +1,68 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use DateTime;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Symfony\Component\Yaml\Yaml;
final class Version20250522212300 extends AbstractMigration
{
private const BLOG_POST_SLUGS = [
'doctor_who_gayness_church',
'does_resurrection_ground_works',
'easter',
'euhwc_toast_to_the_lasses_2024',
'god_is_not_great',
'llms_do_not_understand_anything',
'my_feed_and_reading_list',
'no_more_youtube',
'open_questions_about_sex',
'paradox',
'sapiens_on_religion',
'science_and_philosophy',
'surprised_by_hope',
'tracking_pixels',
'who_consecrates_the_temple',
'word_hallucination_with_reference_to_llms',
];
public function getDescription(): string {
return 'Migrating my blog posts from my old website to notes in my new website';
}
public function up(Schema $schema): void {
foreach (self::BLOG_POST_SLUGS as $slug) {
$blogPostPath = 'scripts/blog-migrated/' . $slug . '.yaml';
$blogPost = Yaml::parseFile($blogPostPath);
$publishedDateTime = DateTime::createFromFormat('U', strval($blogPost['pubDate']));
$publishedDate = $publishedDateTime->format('Y-m-d');
$updatedDateTime = array_key_exists(array: $blogPost, key: 'updatedDate')
? DateTime::createFromFormat('U', strval($blogPost['updatedDate']))
: null;
$updatedDate = $updatedDateTime == null
? 'NULL'
: "'" . $updatedDateTime->format('Y-m-d') . "'";
$title = str_replace("'", "''", $blogPost['title']);
$description = str_replace("'", "''", $blogPost['description']);
$content = str_replace("'", "''", $blogPost['content']);
$this->addSql(<<<SQL
INSERT INTO blog_post(slug, published_date, updated_date, title, description, content)
VALUES('$slug', '$publishedDate', $updatedDate, '$title', '$description', '$content')
SQL);
}
}
public function down(Schema $schema): void {
foreach (self::BLOG_POST_SLUGS as $slug) {
$this->addSql(<<<SQL
DELETE FROM blog_post WHERE slug = '$slug'
SQL);
}
}
}