can write and read notes

This commit is contained in:
2025-05-17 22:47:20 +01:00
parent a8d5c4dcdb
commit 6327c3509e
12 changed files with 352 additions and 4 deletions

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);
}
}