Migriere Persistenz von SQLite zu PostgreSQL (postgresql.lan:5432/essens)
- Dockerfile: pdo_pgsql installieren - migrations: Postgres-Dialekt (SERIAL, TIMESTAMP(0), TEXT) - compose/.env(.dist): postgresql://DATABASE_URL (Passwort via .env.local) - bin/migrate-sqlite-to-pg.sh: einmaliger Datenimport SQLite->PG
This commit is contained in:
@@ -8,26 +8,24 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
* Postgres-Port der ursprünglichen SQLite-Migration (2026-09-18).
|
||||
*/
|
||||
final class Version20260918213517 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
return 'essens_mahlzeiten (Postgres)';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE TABLE essens_mahlzeiten (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) NOT NULL, notiz CLOB DEFAULT NULL, wochentage VARCHAR(32) DEFAULT NULL, sort_order INTEGER NOT NULL, status VARCHAR(32) NOT NULL, gegessen_am DATETIME DEFAULT NULL, erstellt_am DATETIME NOT NULL, aktualisiert_am DATETIME NOT NULL)');
|
||||
$this->addSql('CREATE TABLE essens_mahlzeiten (id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, notiz TEXT DEFAULT NULL, wochentage VARCHAR(32) DEFAULT NULL, sort_order INTEGER NOT NULL, status VARCHAR(32) NOT NULL, gegessen_am TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, erstellt_am TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, aktualisiert_am TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL)');
|
||||
$this->addSql('CREATE INDEX idx_status ON essens_mahlzeiten (status)');
|
||||
$this->addSql('CREATE INDEX idx_sort_order ON essens_mahlzeiten (sort_order)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP TABLE essens_mahlzeiten');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user