<?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 Version20230920121353 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('CREATE TABLE tbl_mouvement_caisse (id INT AUTO_INCREMENT NOT NULL, type_produit_id INT DEFAULT NULL, client VARCHAR(255) NOT NULL, quantite DOUBLE PRECISION NOT NULL, description LONGTEXT DEFAULT NULL, INDEX IDX_C23D5F8C1237A8DE (type_produit_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE lnk_tbl_mouvementCaisse_tbl_file (file_id INT NOT NULL, mouvementCaisse_id INT NOT NULL, INDEX IDX_3A38EAF616268FC8 (mouvementCaisse_id), INDEX IDX_3A38EAF6C8987118 (file_id), PRIMARY KEY(mouvementCaisse_id, file_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE tbl_mouvement_caisse ADD CONSTRAINT FK_C23D5F8C1237A8DE FOREIGN KEY (type_produit_id) REFERENCES ref_type_produit (id)');
$this->addSql('ALTER TABLE lnk_tbl_mouvementCaisse_tbl_file ADD CONSTRAINT FK_3A38EAF616268FC8 FOREIGN KEY (mouvementCaisse_id) REFERENCES tbl_mouvement_caisse (id)');
$this->addSql('ALTER TABLE lnk_tbl_mouvementCaisse_tbl_file ADD CONSTRAINT FK_3A38EAF6C8987118 FOREIGN KEY (file_id) REFERENCES tbl_file (id)');
$this->addSql('ALTER TABLE tbl_mouvement_caisse ADD type_mouvement_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE tbl_mouvement_caisse ADD CONSTRAINT FK_C23D5F8C6B927827 FOREIGN KEY (type_mouvement_id) REFERENCES ref_type_mouvement (id)');
$this->addSql('CREATE INDEX IDX_C23D5F8C6B927827 ON tbl_mouvement_caisse (type_mouvement_id)');
$this->addSql("INSERT INTO ref_type_mouvement (type_mouvement, description, form_name) VALUES ('Sortie','Sortie','_sortie')");
$this->addSql("INSERT INTO ref_type_mouvement (type_mouvement, description, form_name) VALUES ('Entrée','Entrée','_entree')"); $this->addSql('ALTER TABLE tbl_mouvement_caisse ADD created_by INT DEFAULT NULL, ADD updated_by INT DEFAULT NULL, ADD deleted_by INT DEFAULT NULL, ADD created_at DATETIME DEFAULT NULL, ADD updated_at DATETIME DEFAULT NULL, ADD deleted_at DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE tbl_mouvement_caisse ADD CONSTRAINT FK_C23D5F8CDE12AB56 FOREIGN KEY (created_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE tbl_mouvement_caisse ADD CONSTRAINT FK_C23D5F8C16FE72E1 FOREIGN KEY (updated_by) REFERENCES user (user_id)');
$this->addSql('ALTER TABLE tbl_mouvement_caisse ADD CONSTRAINT FK_C23D5F8C1F6FA0AF FOREIGN KEY (deleted_by) REFERENCES user (user_id)');
$this->addSql('CREATE INDEX IDX_C23D5F8CDE12AB56 ON tbl_mouvement_caisse (created_by)');
$this->addSql('CREATE INDEX IDX_C23D5F8C16FE72E1 ON tbl_mouvement_caisse (updated_by)');
$this->addSql('CREATE INDEX IDX_C23D5F8C1F6FA0AF ON tbl_mouvement_caisse (deleted_by)');
$this->addSql('ALTER TABLE tbl_mouvement_caisse ADD date DATE NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE tbl_mouvement_caisse DROP FOREIGN KEY FK_C23D5F8C1237A8DE');
$this->addSql('ALTER TABLE lnk_tbl_mouvementCaisse_tbl_file DROP FOREIGN KEY FK_3A38EAF616268FC8');
$this->addSql('ALTER TABLE lnk_tbl_mouvementCaisse_tbl_file DROP FOREIGN KEY FK_3A38EAF6C8987118');
$this->addSql('DROP TABLE tbl_mouvement_caisse');
$this->addSql('DROP TABLE lnk_tbl_mouvementCaisse_tbl_file');
$this->addSql('ALTER TABLE tbl_mouvement_caisse DROP type_mouvement_id');
$this->addSql('ALTER TABLE tbl_mouvement_caisse DROP created_by, DROP updated_by, DROP deleted_by, DROP created_at, DROP updated_at, DROP deleted_at');
$this->addSql('ALTER TABLE tbl_mouvement_caisse DROP date');
}
}