mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Added database migration for new entities.
This commit is contained in:
parent
7826e3d2ad
commit
408d98c6e1
25 changed files with 246 additions and 99 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Entity\UserSystem\User;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Device;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\Storelocation;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
namespace App\DataTables;
|
||||
|
||||
use App\Entity\Part;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Services\EntityURLGenerator;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Omines\DataTablesBundle\Adapter\Doctrine\ORM\SearchCriteriaProvider;
|
||||
|
@ -65,7 +65,7 @@ class PartsDataTable implements DataTableTypeInterface
|
|||
->add('category', TextColumn::class, ['field' => 'category.name', 'label' => 'category.label'])
|
||||
->add('instock', TextColumn::class, ['label' => 'instock.label_short'])
|
||||
->add('mininstock', TextColumn::class, ['label' => 'mininstock.label_short'])
|
||||
->add('storelocation', TextColumn::class, ['field' => 'storelocation.name', 'label' => 'storelocation.label'])
|
||||
//->add('storelocation', TextColumn::class, ['field' => 'storelocation.name', 'label' => 'storelocation.label'])
|
||||
->addOrderBy('name')
|
||||
->createAdapter(ORMAdapter::class, [
|
||||
'entity' => Part::class,
|
||||
|
|
|
@ -64,6 +64,9 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
*/
|
||||
abstract class NamedDBElement extends DBElement
|
||||
{
|
||||
|
||||
use TimestampTrait;
|
||||
|
||||
/**
|
||||
* @var string The name of this element.
|
||||
* @ORM\Column(type="string")
|
||||
|
@ -72,20 +75,6 @@ abstract class NamedDBElement extends DBElement
|
|||
*/
|
||||
protected $name = '';
|
||||
|
||||
/**
|
||||
* @var \DateTime The date when this element was modified the last time.
|
||||
* @ORM\Column(type="datetimetz", name="last_modified")
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected $lastModified;
|
||||
|
||||
/**
|
||||
* @var \DateTime The date when this element was created.
|
||||
* @ORM\Column(type="datetimetz", name="datetime_added")
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected $addedDate;
|
||||
|
||||
/********************************************************************************
|
||||
*
|
||||
* Getters
|
||||
|
@ -105,28 +94,6 @@ abstract class NamedDBElement extends DBElement
|
|||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last time when the element was modified.
|
||||
* Returns null if the element was not yet saved to DB yet.
|
||||
*
|
||||
* @return \DateTime|null The time of the last edit.
|
||||
*/
|
||||
public function getLastModified(): ?\DateTime
|
||||
{
|
||||
return $this->lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the date/time when the element was created.
|
||||
* Returns null if the element was not yet saved to DB yet.
|
||||
*
|
||||
* @return \DateTime|null The creation time of the part.
|
||||
*/
|
||||
public function getAddedDate(): ?\DateTime
|
||||
{
|
||||
return $this->addedDate;
|
||||
}
|
||||
|
||||
/********************************************************************************
|
||||
*
|
||||
* Setters
|
||||
|
@ -157,19 +124,7 @@ abstract class NamedDBElement extends DBElement
|
|||
*
|
||||
******************************************************************************/
|
||||
|
||||
/**
|
||||
* Helper for updating the timestamp. It is automatically called by doctrine before persisting.
|
||||
*
|
||||
* @ORM\PrePersist
|
||||
* @ORM\PreUpdate
|
||||
*/
|
||||
public function updatedTimestamps(): void
|
||||
{
|
||||
$this->lastModified = new \DateTime('now');
|
||||
if (null === $this->addedDate) {
|
||||
$this->addedDate = new \DateTime('now');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
|
|
92
src/Entity/Base/TimestampTrait.php
Normal file
92
src/Entity/Base/TimestampTrait.php
Normal file
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* part-db version 0.1
|
||||
* Copyright (C) 2005 Christoph Lechner
|
||||
* http://www.cl-projects.de/
|
||||
*
|
||||
* part-db version 0.2+
|
||||
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||
* http://code.google.com/p/part-db/
|
||||
*
|
||||
* Part-DB Version 0.4+
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
/**
|
||||
* A entity with these trait contains informations about, when it was created and edited last time
|
||||
* @package App\Entity\Base
|
||||
*/
|
||||
trait TimestampTrait
|
||||
{
|
||||
/**
|
||||
* @var \DateTime The date when this element was modified the last time.
|
||||
* @ORM\Column(type="datetimetz", name="last_modified")
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected $lastModified;
|
||||
|
||||
/**
|
||||
* @var \DateTime The date when this element was created.
|
||||
* @ORM\Column(type="datetimetz", name="datetime_added")
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected $addedDate;
|
||||
|
||||
/**
|
||||
* Returns the last time when the element was modified.
|
||||
* Returns null if the element was not yet saved to DB yet.
|
||||
*
|
||||
* @return \DateTime|null The time of the last edit.
|
||||
*/
|
||||
public function getLastModified(): ?\DateTime
|
||||
{
|
||||
return $this->lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the date/time when the element was created.
|
||||
* Returns null if the element was not yet saved to DB yet.
|
||||
*
|
||||
* @return \DateTime|null The creation time of the part.
|
||||
*/
|
||||
public function getAddedDate(): ?\DateTime
|
||||
{
|
||||
return $this->addedDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for updating the timestamp. It is automatically called by doctrine before persisting.
|
||||
*
|
||||
* @ORM\PrePersist
|
||||
* @ORM\PreUpdate
|
||||
*/
|
||||
public function updatedTimestamps(): void
|
||||
{
|
||||
$this->lastModified = new \DateTime('now');
|
||||
if (null === $this->addedDate) {
|
||||
$this->addedDate = new \DateTime('now');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -101,15 +101,6 @@ class Part extends AttachmentContainingDBElement
|
|||
*/
|
||||
protected $footprint;
|
||||
|
||||
/**
|
||||
* @var Storelocation|null
|
||||
* @ORM\ManyToOne(targetEntity="Storelocation", inversedBy="parts")
|
||||
* @ORM\JoinColumn(name="id_storelocation", referencedColumnName="id")
|
||||
*
|
||||
* @ColumnSecurity(prefix="storelocation", type="object")
|
||||
*/
|
||||
protected $storelocation;
|
||||
|
||||
/**
|
||||
* @var Manufacturer|null
|
||||
* @ORM\ManyToOne(targetEntity="Manufacturer", inversedBy="parts")
|
||||
|
|
|
@ -32,7 +32,9 @@
|
|||
namespace App\Entity\Parts;
|
||||
|
||||
|
||||
use App\Entity\Base\DBElement;
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
|
@ -42,10 +44,13 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* @package App\Entity\Parts
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="part_lots")
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class PartLot extends NamedDBElement
|
||||
class PartLot extends DBElement
|
||||
{
|
||||
|
||||
use TimestampTrait;
|
||||
|
||||
/**
|
||||
* @var string A short description about this lot, shown in table
|
||||
* @ORM\Column(type="text")
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
namespace App\Form;
|
||||
|
||||
|
||||
use App\Entity\NamedDBElement;
|
||||
use App\Entity\StructuralDBElement;
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
namespace App\Form;
|
||||
|
||||
|
||||
use App\Entity\NamedDBElement;
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
namespace App\Form;
|
||||
|
||||
|
||||
use App\Entity\NamedDBElement;
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TelType;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
namespace App\Form;
|
||||
|
||||
|
||||
use App\Entity\StructuralDBElement;
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Bundle\MakerBundle\Str;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
|
|
|
@ -29,10 +29,10 @@
|
|||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Category;
|
||||
use App\Entity\Manufacturer;
|
||||
use App\Entity\Part;
|
||||
use App\Entity\Storelocation;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\Storelocation;
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
namespace App\Form;
|
||||
|
||||
|
||||
use App\Entity\NamedDBElement;
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
namespace App\Form;
|
||||
|
||||
|
||||
use App\Entity\Group;
|
||||
use App\Entity\NamedDBElement;
|
||||
use App\Entity\StructuralDBElement;
|
||||
use App\Entity\UserSystem\Group;
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Entity\UserSystem\User;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
|
|
104
src/Migrations/Version20190812154222.php
Normal file
104
src/Migrations/Version20190812154222.php
Normal file
|
@ -0,0 +1,104 @@
|
|||
<?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 Version20190812154222 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||
|
||||
$this->addSql('CREATE TABLE `measurement_units` (id INT AUTO_INCREMENT NOT NULL, unit VARCHAR(255) NOT NULL, is_integer TINYINT(1) NOT NULL, use_si_prefix TINYINT(1) NOT NULL, comment LONGTEXT NOT NULL, parent_id INT DEFAULT NULL, not_selectable TINYINT(1) NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME NOT NULL, datetime_added DATETIME NOT NULL, UNIQUE INDEX UNIQ_F5AF83CFDCBB0C53 (unit), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE part_lots (id INT AUTO_INCREMENT NOT NULL, id_store_location INT DEFAULT NULL, id_part INT DEFAULT NULL, description LONGTEXT NOT NULL, comment LONGTEXT NOT NULL, expiration_date DATETIME DEFAULT NULL, instock_unknown TINYINT(1) NOT NULL, instock INT DEFAULT NULL, amount DOUBLE PRECISION DEFAULT NULL, needs_refill TINYINT(1) NOT NULL, last_modified DATETIME NOT NULL, datetime_added DATETIME NOT NULL, INDEX IDX_EBC8F9435D8F4B37 (id_store_location), INDEX IDX_EBC8F943C22F6CC4 (id_part), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
|
||||
$this->addSql('CREATE TABLE currencies (id INT AUTO_INCREMENT NOT NULL, iso_code VARCHAR(255) DEFAULT NULL, exchange_rate NUMERIC(11, 5) NOT NULL, comment LONGTEXT NOT NULL, parent_id INT DEFAULT NULL, not_selectable TINYINT(1) NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME NOT NULL, datetime_added DATETIME NOT NULL, UNIQUE INDEX UNIQ_37C4469362B6A45E (iso_code), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
|
||||
$this->addSql('ALTER TABLE part_lots ADD CONSTRAINT FK_EBC8F9435D8F4B37 FOREIGN KEY (id_store_location) REFERENCES `storelocations` (id)');
|
||||
$this->addSql('ALTER TABLE part_lots ADD CONSTRAINT FK_EBC8F943C22F6CC4 FOREIGN KEY (id_part) REFERENCES `parts` (id)');
|
||||
|
||||
/** Migrate the part locations for parts with known instock */
|
||||
$this->addSql(
|
||||
'INSERT INTO part_lots (id_part, id_store_location, instock, instock_unknown, last_modified, datetime_added) ' .
|
||||
'SELECT parts.id, parts.id_storelocation, parts.instock, 0, NOW(), NOW() FROM parts ' .
|
||||
'WHERE parts.instock >= 0 AND parts.id_storelocation IS NOT NULL'
|
||||
);
|
||||
|
||||
//Migrate part locations for parts with unknown instock
|
||||
$this->addSql(
|
||||
'INSERT INTO part_lots (id_part, id_store_location, instock, instock_unknown, last_modified, datetime_added) ' .
|
||||
'SELECT parts.id, parts.id_storelocation, 0, 1, NOW(), NOW() FROM parts ' .
|
||||
'WHERE parts.instock = -2 AND parts.id_storelocation IS NOT NULL'
|
||||
);
|
||||
|
||||
$this->addSql('ALTER TABLE attachements CHANGE element_id element_id INT DEFAULT NULL, CHANGE type_id type_id INT DEFAULT NULL, CHANGE last_modified last_modified DATETIME NOT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE attachement_types ADD not_selectable TINYINT(1) NOT NULL, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL, CHANGE last_modified last_modified DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE categories ADD not_selectable TINYINT(1) NOT NULL, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL, CHANGE last_modified last_modified DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE devices ADD not_selectable TINYINT(1) NOT NULL, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL, CHANGE last_modified last_modified DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE footprints ADD not_selectable TINYINT(1) NOT NULL, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE filename filename MEDIUMTEXT NOT NULL, CHANGE filename_3d filename_3d MEDIUMTEXT NOT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL, CHANGE last_modified last_modified DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE manufacturers ADD not_selectable TINYINT(1) NOT NULL, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL, CHANGE last_modified last_modified DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE storelocations ADD storage_type_id INT DEFAULT NULL, ADD only_single_part TINYINT(1) NOT NULL, ADD limit_to_existing_parts TINYINT(1) NOT NULL, ADD not_selectable TINYINT(1) NOT NULL, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL, CHANGE last_modified last_modified DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE storelocations ADD CONSTRAINT FK_7517020B270BFF1 FOREIGN KEY (storage_type_id) REFERENCES `measurement_units` (id)');
|
||||
$this->addSql('CREATE INDEX IDX_7517020B270BFF1 ON storelocations (storage_type_id)');
|
||||
$this->addSql('ALTER TABLE suppliers ADD default_currency_id INT DEFAULT NULL, ADD shipping_costs NUMERIC(10, 0) DEFAULT NULL, ADD not_selectable TINYINT(1) NOT NULL, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL, CHANGE last_modified last_modified DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE suppliers ADD CONSTRAINT FK_AC28B95CECD792C0 FOREIGN KEY (default_currency_id) REFERENCES currencies (id)');
|
||||
$this->addSql('CREATE INDEX IDX_AC28B95CECD792C0 ON suppliers (default_currency_id)');
|
||||
$this->addSql('ALTER TABLE parts DROP FOREIGN KEY parts_id_storelocation_fk');
|
||||
$this->addSql('DROP INDEX IDX_6940A7FE8DF69834 ON parts');
|
||||
$this->addSql('ALTER TABLE parts ADD id_part_unit INT DEFAULT NULL, ADD minamount DOUBLE PRECISION NOT NULL, ADD manufacturer_product_number VARCHAR(255) NOT NULL, ADD needs_review TINYINT(1) NOT NULL, ADD tags LONGTEXT NOT NULL, ADD mass DOUBLE PRECISION DEFAULT NULL, DROP id_storelocation, DROP instock, CHANGE id_category id_category INT DEFAULT NULL, CHANGE id_footprint id_footprint INT DEFAULT NULL, CHANGE order_orderdetails_id order_orderdetails_id INT DEFAULT NULL, CHANGE id_manufacturer id_manufacturer INT DEFAULT NULL, CHANGE id_master_picture_attachement id_master_picture_attachement INT DEFAULT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL, CHANGE last_modified last_modified DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE parts ADD CONSTRAINT FK_6940A7FE2626CEF9 FOREIGN KEY (id_part_unit) REFERENCES `measurement_units` (id)');
|
||||
$this->addSql('CREATE INDEX IDX_6940A7FE2626CEF9 ON parts (id_part_unit)');
|
||||
$this->addSql('ALTER TABLE users CHANGE group_id group_id INT DEFAULT NULL, CHANGE password password VARCHAR(255) DEFAULT NULL, CHANGE first_name first_name VARCHAR(255) DEFAULT NULL, CHANGE last_name last_name VARCHAR(255) DEFAULT NULL, CHANGE department department VARCHAR(255) DEFAULT NULL, CHANGE email email VARCHAR(255) DEFAULT NULL, CHANGE config_language config_language VARCHAR(255) DEFAULT NULL, CHANGE config_timezone config_timezone VARCHAR(255) DEFAULT NULL, CHANGE config_theme config_theme VARCHAR(255) DEFAULT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL, CHANGE last_modified last_modified DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE device_parts CHANGE id_part id_part INT DEFAULT NULL, CHANGE id_device id_device INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE orderdetails CHANGE part_id part_id INT DEFAULT NULL, CHANGE id_supplier id_supplier INT DEFAULT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE pricedetails ADD id_currency INT DEFAULT NULL, CHANGE orderdetails_id orderdetails_id INT DEFAULT NULL, CHANGE last_modified last_modified DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE pricedetails ADD CONSTRAINT FK_C68C4459398D64AA FOREIGN KEY (id_currency) REFERENCES currencies (id)');
|
||||
$this->addSql('CREATE INDEX IDX_C68C4459398D64AA ON pricedetails (id_currency)');
|
||||
$this->addSql('ALTER TABLE groups ADD not_selectable TINYINT(1) NOT NULL, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL, CHANGE last_modified last_modified DATETIME NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE `storelocations` DROP FOREIGN KEY FK_7517020B270BFF1');
|
||||
$this->addSql('ALTER TABLE `parts` DROP FOREIGN KEY FK_6940A7FE2626CEF9');
|
||||
$this->addSql('ALTER TABLE `suppliers` DROP FOREIGN KEY FK_AC28B95CECD792C0');
|
||||
$this->addSql('ALTER TABLE `pricedetails` DROP FOREIGN KEY FK_C68C4459398D64AA');
|
||||
$this->addSql('DROP TABLE `measurement_units`');
|
||||
$this->addSql('DROP TABLE part_lots');
|
||||
$this->addSql('DROP TABLE currencies');
|
||||
$this->addSql('ALTER TABLE `attachement_types` DROP not_selectable, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE last_modified last_modified DATETIME NOT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE `attachements` CHANGE type_id type_id INT DEFAULT NULL, CHANGE element_id element_id INT DEFAULT NULL, CHANGE last_modified last_modified DATETIME NOT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE `categories` DROP not_selectable, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE last_modified last_modified DATETIME NOT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE `device_parts` CHANGE id_device id_device INT DEFAULT NULL, CHANGE id_part id_part INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE `devices` DROP not_selectable, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE last_modified last_modified DATETIME NOT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE `footprints` DROP not_selectable, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE filename filename MEDIUMTEXT NOT NULL COLLATE utf8_unicode_ci, CHANGE filename_3d filename_3d MEDIUMTEXT NOT NULL COLLATE utf8_unicode_ci, CHANGE last_modified last_modified DATETIME NOT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE `groups` DROP not_selectable, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE last_modified last_modified DATETIME NOT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE `manufacturers` DROP not_selectable, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE last_modified last_modified DATETIME NOT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE `orderdetails` CHANGE part_id part_id INT DEFAULT NULL, CHANGE id_supplier id_supplier INT DEFAULT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
||||
$this->addSql('DROP INDEX IDX_6940A7FE2626CEF9 ON `parts`');
|
||||
$this->addSql('ALTER TABLE `parts` ADD id_storelocation INT DEFAULT NULL, ADD instock INT NOT NULL, DROP id_part_unit, DROP minamount, DROP manufacturer_product_number, DROP needs_review, DROP tags, DROP mass, CHANGE id_category id_category INT DEFAULT NULL, CHANGE id_footprint id_footprint INT DEFAULT NULL, CHANGE id_manufacturer id_manufacturer INT DEFAULT NULL, CHANGE id_master_picture_attachement id_master_picture_attachement INT DEFAULT NULL, CHANGE order_orderdetails_id order_orderdetails_id INT DEFAULT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL, CHANGE last_modified last_modified DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE `parts` ADD CONSTRAINT parts_id_storelocation_fk FOREIGN KEY (id_storelocation) REFERENCES storelocations (id)');
|
||||
$this->addSql('CREATE INDEX IDX_6940A7FE8DF69834 ON `parts` (id_storelocation)');
|
||||
$this->addSql('DROP INDEX IDX_C68C4459398D64AA ON `pricedetails`');
|
||||
$this->addSql('ALTER TABLE `pricedetails` DROP id_currency, CHANGE orderdetails_id orderdetails_id INT DEFAULT NULL, CHANGE last_modified last_modified DATETIME NOT NULL');
|
||||
$this->addSql('DROP INDEX IDX_7517020B270BFF1 ON `storelocations`');
|
||||
$this->addSql('ALTER TABLE `storelocations` DROP storage_type_id, DROP only_single_part, DROP limit_to_existing_parts, DROP not_selectable, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE last_modified last_modified DATETIME NOT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
||||
$this->addSql('DROP INDEX IDX_AC28B95CECD792C0 ON `suppliers`');
|
||||
$this->addSql('ALTER TABLE `suppliers` DROP default_currency_id, DROP shipping_costs, DROP not_selectable, CHANGE parent_id parent_id INT DEFAULT NULL, CHANGE last_modified last_modified DATETIME NOT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
||||
$this->addSql('ALTER TABLE `users` CHANGE group_id group_id INT DEFAULT NULL, CHANGE password password VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8_general_ci, CHANGE first_name first_name VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8_general_ci, CHANGE last_name last_name VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8_general_ci, CHANGE department department VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8_general_ci, CHANGE email email VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8_general_ci, CHANGE config_language config_language VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8_general_ci, CHANGE config_timezone config_timezone VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8_general_ci, CHANGE config_theme config_theme VARCHAR(255) DEFAULT \'NULL\' COLLATE utf8_general_ci, CHANGE last_modified last_modified DATETIME NOT NULL, CHANGE datetime_added datetime_added DATETIME NOT NULL');
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@
|
|||
namespace App\Services;
|
||||
|
||||
|
||||
use App\Entity\Attachment;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use SebastianBergmann\CodeCoverage\Node\File;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
namespace App\Services;
|
||||
|
||||
|
||||
use App\Entity\NamedDBElement;
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
namespace App\Services;
|
||||
|
||||
|
||||
use App\Entity\StructuralDBElement;
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\MakerBundle\Str;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
|
|
|
@ -29,17 +29,17 @@
|
|||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Entity\Attachment;
|
||||
use App\Entity\AttachmentType;
|
||||
use App\Entity\Category;
|
||||
use App\Entity\Device;
|
||||
use App\Entity\Footprint;
|
||||
use App\Entity\Manufacturer;
|
||||
use App\Entity\NamedDBElement;
|
||||
use App\Entity\Part;
|
||||
use App\Entity\Storelocation;
|
||||
use App\Entity\Supplier;
|
||||
use App\Entity\User;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\Storelocation;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Exceptions\EntityNotSupported;
|
||||
use Symfony\Component\HttpKernel\HttpCache\Store;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
namespace App\Services;
|
||||
|
||||
use App\Configuration\PermissionsConfiguration;
|
||||
use App\Entity\User;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Security\Interfaces\HasPermissionsInterface;
|
||||
use Symfony\Component\Config\ConfigCache;
|
||||
use Symfony\Component\Config\Definition\Processor;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
namespace App\Services;
|
||||
|
||||
|
||||
use App\Entity\StructuralDBElement;
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class StructuralElementRecursionHelper
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Entity\DBElement;
|
||||
use App\Entity\NamedDBElement;
|
||||
use App\Entity\StructuralDBElement;
|
||||
use App\Entity\Base\DBElement;
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use App\Helpers\TreeViewNode;
|
||||
use App\Repository\StructuralDBElementRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
|
||||
namespace App\Twig;
|
||||
|
||||
use App\Entity\Attachment;
|
||||
use App\Entity\DBElement;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Base\DBElement;
|
||||
use App\Services\EntityURLGenerator;
|
||||
use App\Services\MoneyFormatter;
|
||||
use App\Services\TreeBuilder;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
namespace App\Validator\Constraints;
|
||||
|
||||
|
||||
use App\Entity\StructuralDBElement;
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use Symfony\Bundle\MakerBundle\Str;
|
||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue