Skip to content

Instantly share code, notes, and snippets.

@rufinus
Last active December 17, 2015 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rufinus/5603922 to your computer and use it in GitHub Desktop.
Save rufinus/5603922 to your computer and use it in GitHub Desktop.
<?php
namespace Application\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* Application\Entity\Locale
*
* @ORM\Entity(repositoryClass="Application\Repository\LocaleRepository")
* @ORM\Table(name="`locale`")
*/
class Locale
{
/**
* @ORM\Id
* @ORM\Column(name="`locale_id`", type="string", length=5)
*/
protected $locale_id;
/**
* @ORM\Column(name="`locale_plural_forms`", type="string", length=255)
*/
protected $locale_plural_forms;
/**
* @ORM\OneToMany(targetEntity="Mandator", mappedBy="locale")
* @ORM\JoinColumn(name="locale_id", referencedColumnName="locale_id", nullable=false)
*/
protected $mandators;
/**
* @ORM\OneToMany(targetEntity="Message", mappedBy="locale")
* @ORM\JoinColumn(name="locale_id", referencedColumnName="locale_id", nullable=false)
*/
protected $messages;
public function __construct()
{
$this->mandators = new ArrayCollection();
$this->messages = new ArrayCollection();
}
/**
* Set the value of locale_id.
*
* @param string $locale_id
* @return \Application\Entity\Locale
*/
public function setLocaleId($locale_id)
{
$this->locale_id = $locale_id;
return $this;
}
/**
* Get the value of locale_id.
*
* @return string
*/
public function getLocaleId()
{
return $this->locale_id;
}
/**
* Set the value of locale_plural_forms.
*
* @param string $locale_plural_forms
* @return \Application\Entity\Locale
*/
public function setLocalePluralForms($locale_plural_forms)
{
$this->locale_plural_forms = $locale_plural_forms;
return $this;
}
/**
* Get the value of locale_plural_forms.
*
* @return string
*/
public function getLocalePluralForms()
{
return $this->locale_plural_forms;
}
/**
* Add Mandator entity to collection (one to many).
*
* @param \Application\Entity\Mandator $mandator
* @return \Application\Entity\Locale
*/
public function addMandator(Mandator $mandator)
{
$this->mandators[] = $mandator;
return $this;
}
/**
* Get Mandator entity collection (one to many).
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getMandators()
{
return $this->mandators;
}
/**
* Add Message entity to collection (one to many).
*
* @param \Application\Entity\Message $message
* @return \Application\Entity\Locale
*/
public function addMessage(Message $message)
{
$this->messages[] = $message;
return $this;
}
/**
* Get Message entity collection (one to many).
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getMessages()
{
return $this->messages;
}
public function __sleep()
{
return array('locale_id', 'locale_plural_forms');
}
}
<?php
namespace Application\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* Application\Entity\Mandator
*
* @ORM\Entity(repositoryClass="Application\Repository\MandatorRepository")
* @ORM\Table(name="`mandator`", indexes={@ORM\Index(name="fk_mandator_locale1_idx", columns={"locale_id"})})
*/
class Mandator
{
/**
* @ORM\Id
* @ORM\Column(name="`mandator_id`", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $mandator_id;
/**
* @ORM\Column(name="`name`", type="string", length=200)
*/
protected $name;
/**
* @ORM\Column(name="`logo`", type="string", length=200, nullable=true)
*/
protected $logo;
/**
* @ORM\Column(name="`color`", type="string", length=6, nullable=true)
*/
protected $color;
/**
* @ORM\Column(name="`helplink`", type="string", length=200, nullable=true)
*/
protected $helplink;
/**
* @ORM\Column(name="`market_research`", type="string", length=100, nullable=true)
*/
protected $market_research;
/**
* @ORM\Column(name="`contact_name`", type="string", length=200, nullable=true)
*/
protected $contact_name;
/**
* @ORM\Column(name="`contact_address`", type="string", length=255, nullable=true)
*/
protected $contact_address;
/**
* @ORM\Column(name="`contact_zipcode`", type="integer", nullable=true)
*/
protected $contact_zipcode;
/**
* @ORM\Column(name="`contact_city`", type="string", length=100, nullable=true)
*/
protected $contact_city;
/**
* @ORM\Column(name="`contact_country`", type="string", length=100, nullable=true)
*/
protected $contact_country;
/**
* @ORM\Column(name="`contact_phone`", type="string", length=20, nullable=true)
*/
protected $contact_phone;
/**
* @ORM\Column(name="`contact_fax`", type="string", length=20, nullable=true)
*/
protected $contact_fax;
/**
* @ORM\Column(name="`contact_email`", type="string", length=150, nullable=true)
*/
protected $contact_email;
/**
* @ORM\Column(name="`status`", type="boolean")
*/
protected $status;
/**
* @ORM\Column(name="`licence`", type="boolean")
*/
protected $licence;
/**
* @ORM\OneToMany(targetEntity="Calendar", mappedBy="mandator")
* @ORM\JoinColumn(name="mandator_id", referencedColumnName="mandator_id", nullable=false)
*/
protected $calendars;
/**
* @ORM\OneToMany(targetEntity="Config", mappedBy="mandator")
* @ORM\JoinColumn(name="mandator_id", referencedColumnName="mandator_id", nullable=false)
*/
protected $configs;
/**
* @ORM\OneToMany(targetEntity="User", mappedBy="mandator")
* @ORM\JoinColumn(name="mandator_id", referencedColumnName="mandator_id", nullable=false)
*/
protected $users;
/**
* @ORM\ManyToOne(targetEntity="Locale", inversedBy="mandators")
* @ORM\JoinColumn(name="locale_id", referencedColumnName="locale_id", onDelete="CASCADE", nullable=false)
*/
protected $locale;
public function __construct()
{
$this->calendars = new ArrayCollection();
$this->configs = new ArrayCollection();
$this->users = new ArrayCollection();
}
/**
* Set the value of mandator_id.
*
* @param integer $mandator_id
* @return \Application\Entity\Mandator
*/
public function setMandatorId($mandator_id)
{
$this->mandator_id = $mandator_id;
return $this;
}
/**
* Get the value of mandator_id.
*
* @return integer
*/
public function getMandatorId()
{
return $this->mandator_id;
}
/**
* Set the value of name.
*
* @param string $name
* @return \Application\Entity\Mandator
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get the value of name.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the value of logo.
*
* @param string $logo
* @return \Application\Entity\Mandator
*/
public function setLogo($logo)
{
$this->logo = $logo;
return $this;
}
/**
* Get the value of logo.
*
* @return string
*/
public function getLogo()
{
return $this->logo;
}
/**
* Set the value of color.
*
* @param string $color
* @return \Application\Entity\Mandator
*/
public function setColor($color)
{
$this->color = $color;
return $this;
}
/**
* Get the value of color.
*
* @return string
*/
public function getColor()
{
return $this->color;
}
/**
* Set the value of helplink.
*
* @param string $helplink
* @return \Application\Entity\Mandator
*/
public function setHelplink($helplink)
{
$this->helplink = $helplink;
return $this;
}
/**
* Get the value of helplink.
*
* @return string
*/
public function getHelplink()
{
return $this->helplink;
}
/**
* Set the value of market_research.
*
* @param string $market_research
* @return \Application\Entity\Mandator
*/
public function setMarketResearch($market_research)
{
$this->market_research = $market_research;
return $this;
}
/**
* Get the value of market_research.
*
* @return string
*/
public function getMarketResearch()
{
return $this->market_research;
}
/**
* Set the value of contact_name.
*
* @param string $contact_name
* @return \Application\Entity\Mandator
*/
public function setContactName($contact_name)
{
$this->contact_name = $contact_name;
return $this;
}
/**
* Get the value of contact_name.
*
* @return string
*/
public function getContactName()
{
return $this->contact_name;
}
/**
* Set the value of contact_address.
*
* @param string $contact_address
* @return \Application\Entity\Mandator
*/
public function setContactAddress($contact_address)
{
$this->contact_address = $contact_address;
return $this;
}
/**
* Get the value of contact_address.
*
* @return string
*/
public function getContactAddress()
{
return $this->contact_address;
}
/**
* Set the value of contact_zipcode.
*
* @param integer $contact_zipcode
* @return \Application\Entity\Mandator
*/
public function setContactZipcode($contact_zipcode)
{
$this->contact_zipcode = $contact_zipcode;
return $this;
}
/**
* Get the value of contact_zipcode.
*
* @return integer
*/
public function getContactZipcode()
{
return $this->contact_zipcode;
}
/**
* Set the value of contact_city.
*
* @param string $contact_city
* @return \Application\Entity\Mandator
*/
public function setContactCity($contact_city)
{
$this->contact_city = $contact_city;
return $this;
}
/**
* Get the value of contact_city.
*
* @return string
*/
public function getContactCity()
{
return $this->contact_city;
}
/**
* Set the value of contact_country.
*
* @param string $contact_country
* @return \Application\Entity\Mandator
*/
public function setContactCountry($contact_country)
{
$this->contact_country = $contact_country;
return $this;
}
/**
* Get the value of contact_country.
*
* @return string
*/
public function getContactCountry()
{
return $this->contact_country;
}
/**
* Set the value of contact_phone.
*
* @param string $contact_phone
* @return \Application\Entity\Mandator
*/
public function setContactPhone($contact_phone)
{
$this->contact_phone = $contact_phone;
return $this;
}
/**
* Get the value of contact_phone.
*
* @return string
*/
public function getContactPhone()
{
return $this->contact_phone;
}
/**
* Set the value of contact_fax.
*
* @param string $contact_fax
* @return \Application\Entity\Mandator
*/
public function setContactFax($contact_fax)
{
$this->contact_fax = $contact_fax;
return $this;
}
/**
* Get the value of contact_fax.
*
* @return string
*/
public function getContactFax()
{
return $this->contact_fax;
}
/**
* Set the value of contact_email.
*
* @param string $contact_email
* @return \Application\Entity\Mandator
*/
public function setContactEmail($contact_email)
{
$this->contact_email = $contact_email;
return $this;
}
/**
* Get the value of contact_email.
*
* @return string
*/
public function getContactEmail()
{
return $this->contact_email;
}
/**
* Set the value of status.
*
* @param boolean $status
* @return \Application\Entity\Mandator
*/
public function setStatus($status)
{
$this->status = $status;
return $this;
}
/**
* Get the value of status.
*
* @return boolean
*/
public function getStatus()
{
return $this->status;
}
/**
* Set the value of licence.
*
* @param boolean $licence
* @return \Application\Entity\Mandator
*/
public function setLicence($licence)
{
$this->licence = $licence;
return $this;
}
/**
* Get the value of licence.
*
* @return boolean
*/
public function getLicence()
{
return $this->licence;
}
/**
* Add Calendar entity to collection (one to many).
*
* @param \Application\Entity\Calendar $calendar
* @return \Application\Entity\Mandator
*/
public function addCalendar(Calendar $calendar)
{
$this->calendars[] = $calendar;
return $this;
}
/**
* Get Calendar entity collection (one to many).
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getCalendars()
{
return $this->calendars;
}
/**
* Add Config entity to collection (one to many).
*
* @param \Application\Entity\Config $config
* @return \Application\Entity\Mandator
*/
public function addConfig(Config $config)
{
$this->configs[] = $config;
return $this;
}
/**
* Get Config entity collection (one to many).
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getConfigs()
{
return $this->configs;
}
/**
* Add User entity to collection (one to many).
*
* @param \Application\Entity\User $user
* @return \Application\Entity\Mandator
*/
public function addUser(User $user)
{
$this->users[] = $user;
return $this;
}
/**
* Get User entity collection (one to many).
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getUsers()
{
return $this->users;
}
/**
* Set Locale entity (many to one).
*
* @param \Application\Entity\Locale $locale
* @return \Application\Entity\Mandator
*/
public function setLocale(Locale $locale = null)
{
$this->locale = $locale;
return $this;
}
/**
* Get Locale entity (many to one).
*
* @return \Application\Entity\Locale
*/
public function getLocale()
{
return $this->locale;
}
public function __sleep()
{
return array('mandator_id', 'locale_id', 'name', 'logo', 'color', 'helplink', 'market_research', 'contact_name', 'contact_address', 'contact_zipcode', 'contact_city', 'contact_country', 'contact_phone', 'contact_fax', 'contact_email', 'status', 'licence');
}
}
<?php
namespace KimapMigration;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your need!
*/
class Version20130518120910 extends AbstractMigration
{
public function up(Schema $schema)
{
// 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("ALTER TABLE config DROP FOREIGN KEY FK_D48A2F7CF0C46DC5");
$this->addSql("ALTER TABLE config ADD CONSTRAINT FK_D48A2F7CF0C46DC5 FOREIGN KEY (mandator_id) REFERENCES `mandator` (mandator_id)");
$this->addSql("ALTER TABLE user DROP FOREIGN KEY FK_8D93D649F0C46DC5");
$this->addSql("ALTER TABLE user ADD CONSTRAINT FK_8D93D649F0C46DC5 FOREIGN KEY (mandator_id) REFERENCES `mandator` (mandator_id)");
$this->addSql("ALTER TABLE user_has_role DROP FOREIGN KEY FK_EAB8B535A76ED395");
$this->addSql("ALTER TABLE user_has_role DROP FOREIGN KEY FK_EAB8B535D60322AC");
$this->addSql("ALTER TABLE user_has_role ADD CONSTRAINT FK_EAB8B535A76ED395 FOREIGN KEY (user_id) REFERENCES `user` (user_id)");
$this->addSql("ALTER TABLE user_has_role ADD CONSTRAINT FK_EAB8B535D60322AC FOREIGN KEY (role_id) REFERENCES `role` (role_id)");
$this->addSql("ALTER TABLE calendar DROP FOREIGN KEY FK_6EA9A146F0C46DC5");
$this->addSql("ALTER TABLE calendar DROP FOREIGN KEY FK_6EA9A146CC481A2F");
$this->addSql("ALTER TABLE calendar ADD CONSTRAINT FK_6EA9A146F0C46DC5 FOREIGN KEY (mandator_id) REFERENCES `mandator` (mandator_id)");
$this->addSql("ALTER TABLE calendar ADD CONSTRAINT FK_6EA9A146CC481A2F FOREIGN KEY (calender_layout_id) REFERENCES `calendar_layout` (calender_layout_id)");
$this->addSql("ALTER TABLE milestone DROP FOREIGN KEY FK_4FAC838271F7E88B");
$this->addSql("ALTER TABLE milestone ADD CONSTRAINT FK_4FAC838271F7E88B FOREIGN KEY (event_id) REFERENCES `event` (event_id)");
$this->addSql("ALTER TABLE message DROP FOREIGN KEY FK_B6BD307FE559DFD1");
$this->addSql("ALTER TABLE message ADD CONSTRAINT FK_B6BD307FE559DFD1 FOREIGN KEY (locale_id) REFERENCES `locale` (locale_id)");
$this->addSql("ALTER TABLE tab DROP FOREIGN KEY FK_73E3430CA40A2C8");
$this->addSql("ALTER TABLE tab DROP FOREIGN KEY FK_73E3430C9D1F3581");
$this->addSql("ALTER TABLE tab ADD CONSTRAINT FK_73E3430CA40A2C8 FOREIGN KEY (calendar_id) REFERENCES `calendar` (calendar_id)");
$this->addSql("ALTER TABLE tab ADD CONSTRAINT FK_73E3430C9D1F3581 FOREIGN KEY (versionset_id) REFERENCES `versionset` (versionset_id)");
$this->addSql("ALTER TABLE mandator DROP FOREIGN KEY FK_D14DA567E559DFD1");
$this->addSql("ALTER TABLE mandator ADD CONSTRAINT FK_D14DA567E559DFD1 FOREIGN KEY (locale_id) REFERENCES `locale` (locale_id) ON DELETE CASCADE");
$this->addSql("ALTER TABLE versionset DROP FOREIGN KEY FK_CBE9C7E9A40A2C8");
$this->addSql("ALTER TABLE versionset ADD CONSTRAINT FK_CBE9C7E9A40A2C8 FOREIGN KEY (calendar_id) REFERENCES `calendar` (calendar_id)");
$this->addSql("ALTER TABLE role_has_permission DROP FOREIGN KEY FK_6F82580FFED90CCA");
$this->addSql("ALTER TABLE role_has_permission DROP FOREIGN KEY FK_6F82580FD60322AC");
$this->addSql("ALTER TABLE role_has_permission ADD CONSTRAINT FK_6F82580FFED90CCA FOREIGN KEY (permission_id) REFERENCES `permission` (permission_id)");
$this->addSql("ALTER TABLE role_has_permission ADD CONSTRAINT FK_6F82580FD60322AC FOREIGN KEY (role_id) REFERENCES `role` (role_id)");
$this->addSql("ALTER TABLE field DROP FOREIGN KEY FK_5BF545589D1F3581");
$this->addSql("ALTER TABLE field DROP FOREIGN KEY FK_5BF54558727ACA70");
$this->addSql("ALTER TABLE field DROP FOREIGN KEY FK_5BF545588D0C9323");
$this->addSql("ALTER TABLE field ADD CONSTRAINT FK_5BF545589D1F3581 FOREIGN KEY (versionset_id) REFERENCES `versionset` (versionset_id)");
$this->addSql("ALTER TABLE field ADD CONSTRAINT FK_5BF54558727ACA70 FOREIGN KEY (parent_id) REFERENCES `field` (field_id)");
$this->addSql("ALTER TABLE field ADD CONSTRAINT FK_5BF545588D0C9323 FOREIGN KEY (tab_id) REFERENCES `tab` (tab_id)");
$this->addSql("ALTER TABLE event DROP FOREIGN KEY FK_3BAE0AA7A40A2C8");
$this->addSql("ALTER TABLE event DROP FOREIGN KEY FK_3BAE0AA7443707B0");
$this->addSql("ALTER TABLE event DROP FOREIGN KEY FK_3BAE0AA79D1F3581");
$this->addSql("ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA7A40A2C8 FOREIGN KEY (calendar_id) REFERENCES `calendar` (calendar_id)");
$this->addSql("ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA7443707B0 FOREIGN KEY (field_id) REFERENCES `field` (field_id)");
$this->addSql("ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA79D1F3581 FOREIGN KEY (versionset_id) REFERENCES `versionset` (versionset_id)");
$this->addSql("ALTER TABLE rating DROP FOREIGN KEY FK_D88926229D1F3581");
$this->addSql("ALTER TABLE rating DROP FOREIGN KEY FK_D8892622443707B0");
$this->addSql("ALTER TABLE rating DROP FOREIGN KEY FK_D889262271F7E88B");
$this->addSql("ALTER TABLE rating ADD CONSTRAINT FK_D88926229D1F3581 FOREIGN KEY (versionset_id) REFERENCES `versionset` (versionset_id)");
$this->addSql("ALTER TABLE rating ADD CONSTRAINT FK_D8892622443707B0 FOREIGN KEY (field_id) REFERENCES `field` (field_id)");
$this->addSql("ALTER TABLE rating ADD CONSTRAINT FK_D889262271F7E88B FOREIGN KEY (event_id) REFERENCES `event` (event_id)");
$this->addSql("ALTER TABLE role DROP FOREIGN KEY FK_57698A6AA44B56EA");
$this->addSql("ALTER TABLE role ADD CONSTRAINT FK_57698A6AA44B56EA FOREIGN KEY (parent_role_id) REFERENCES `role` (role_id)");
}
public function down(Schema $schema)
{
// 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 calendar DROP FOREIGN KEY FK_6EA9A146F0C46DC5");
$this->addSql("ALTER TABLE calendar DROP FOREIGN KEY FK_6EA9A146CC481A2F");
$this->addSql("ALTER TABLE calendar ADD CONSTRAINT FK_6EA9A146F0C46DC5 FOREIGN KEY (mandator_id) REFERENCES mandator (mandator_id)");
$this->addSql("ALTER TABLE calendar ADD CONSTRAINT FK_6EA9A146CC481A2F FOREIGN KEY (calender_layout_id) REFERENCES calendar_layout (calender_layout_id)");
$this->addSql("ALTER TABLE config DROP FOREIGN KEY FK_D48A2F7CF0C46DC5");
$this->addSql("ALTER TABLE config ADD CONSTRAINT FK_D48A2F7CF0C46DC5 FOREIGN KEY (mandator_id) REFERENCES mandator (mandator_id)");
$this->addSql("ALTER TABLE event DROP FOREIGN KEY FK_3BAE0AA7A40A2C8");
$this->addSql("ALTER TABLE event DROP FOREIGN KEY FK_3BAE0AA79D1F3581");
$this->addSql("ALTER TABLE event DROP FOREIGN KEY FK_3BAE0AA7443707B0");
$this->addSql("ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA7A40A2C8 FOREIGN KEY (calendar_id) REFERENCES calendar (calendar_id)");
$this->addSql("ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA79D1F3581 FOREIGN KEY (versionset_id) REFERENCES versionset (versionset_id)");
$this->addSql("ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA7443707B0 FOREIGN KEY (field_id) REFERENCES field (field_id)");
$this->addSql("ALTER TABLE field DROP FOREIGN KEY FK_5BF545588D0C9323");
$this->addSql("ALTER TABLE field DROP FOREIGN KEY FK_5BF545589D1F3581");
$this->addSql("ALTER TABLE field DROP FOREIGN KEY FK_5BF54558727ACA70");
$this->addSql("ALTER TABLE field ADD CONSTRAINT FK_5BF545588D0C9323 FOREIGN KEY (tab_id) REFERENCES tab (tab_id)");
$this->addSql("ALTER TABLE field ADD CONSTRAINT FK_5BF545589D1F3581 FOREIGN KEY (versionset_id) REFERENCES versionset (versionset_id)");
$this->addSql("ALTER TABLE field ADD CONSTRAINT FK_5BF54558727ACA70 FOREIGN KEY (parent_id) REFERENCES field (field_id)");
$this->addSql("ALTER TABLE mandator DROP FOREIGN KEY FK_D14DA567E559DFD1");
$this->addSql("ALTER TABLE mandator ADD CONSTRAINT FK_D14DA567E559DFD1 FOREIGN KEY (locale_id) REFERENCES locale (locale_id) ON DELETE CASCADE");
$this->addSql("ALTER TABLE message DROP FOREIGN KEY FK_B6BD307FE559DFD1");
$this->addSql("ALTER TABLE message ADD CONSTRAINT FK_B6BD307FE559DFD1 FOREIGN KEY (locale_id) REFERENCES locale (locale_id)");
$this->addSql("ALTER TABLE milestone DROP FOREIGN KEY FK_4FAC838271F7E88B");
$this->addSql("ALTER TABLE milestone ADD CONSTRAINT FK_4FAC838271F7E88B FOREIGN KEY (event_id) REFERENCES event (event_id)");
$this->addSql("ALTER TABLE rating DROP FOREIGN KEY FK_D889262271F7E88B");
$this->addSql("ALTER TABLE rating DROP FOREIGN KEY FK_D88926229D1F3581");
$this->addSql("ALTER TABLE rating DROP FOREIGN KEY FK_D8892622443707B0");
$this->addSql("ALTER TABLE rating ADD CONSTRAINT FK_D889262271F7E88B FOREIGN KEY (event_id) REFERENCES event (event_id)");
$this->addSql("ALTER TABLE rating ADD CONSTRAINT FK_D88926229D1F3581 FOREIGN KEY (versionset_id) REFERENCES versionset (versionset_id)");
$this->addSql("ALTER TABLE rating ADD CONSTRAINT FK_D8892622443707B0 FOREIGN KEY (field_id) REFERENCES field (field_id)");
$this->addSql("ALTER TABLE role DROP FOREIGN KEY FK_57698A6AA44B56EA");
$this->addSql("ALTER TABLE role ADD CONSTRAINT FK_57698A6AA44B56EA FOREIGN KEY (parent_role_id) REFERENCES role (role_id)");
$this->addSql("ALTER TABLE role_has_permission DROP FOREIGN KEY FK_6F82580FD60322AC");
$this->addSql("ALTER TABLE role_has_permission DROP FOREIGN KEY FK_6F82580FFED90CCA");
$this->addSql("ALTER TABLE role_has_permission ADD CONSTRAINT FK_6F82580FD60322AC FOREIGN KEY (role_id) REFERENCES role (role_id)");
$this->addSql("ALTER TABLE role_has_permission ADD CONSTRAINT FK_6F82580FFED90CCA FOREIGN KEY (permission_id) REFERENCES permission (permission_id)");
$this->addSql("ALTER TABLE tab DROP FOREIGN KEY FK_73E3430C9D1F3581");
$this->addSql("ALTER TABLE tab DROP FOREIGN KEY FK_73E3430CA40A2C8");
$this->addSql("ALTER TABLE tab ADD CONSTRAINT FK_73E3430C9D1F3581 FOREIGN KEY (versionset_id) REFERENCES versionset (versionset_id)");
$this->addSql("ALTER TABLE tab ADD CONSTRAINT FK_73E3430CA40A2C8 FOREIGN KEY (calendar_id) REFERENCES calendar (calendar_id)");
$this->addSql("ALTER TABLE user DROP FOREIGN KEY FK_8D93D649F0C46DC5");
$this->addSql("ALTER TABLE user ADD CONSTRAINT FK_8D93D649F0C46DC5 FOREIGN KEY (mandator_id) REFERENCES mandator (mandator_id)");
$this->addSql("ALTER TABLE user_has_role DROP FOREIGN KEY FK_EAB8B535A76ED395");
$this->addSql("ALTER TABLE user_has_role DROP FOREIGN KEY FK_EAB8B535D60322AC");
$this->addSql("ALTER TABLE user_has_role ADD CONSTRAINT FK_EAB8B535A76ED395 FOREIGN KEY (user_id) REFERENCES user (user_id)");
$this->addSql("ALTER TABLE user_has_role ADD CONSTRAINT FK_EAB8B535D60322AC FOREIGN KEY (role_id) REFERENCES role (role_id)");
$this->addSql("ALTER TABLE versionset DROP FOREIGN KEY FK_CBE9C7E9A40A2C8");
$this->addSql("ALTER TABLE versionset ADD CONSTRAINT FK_CBE9C7E9A40A2C8 FOREIGN KEY (calendar_id) REFERENCES calendar (calendar_id)");
}
}
<?php
namespace KimapMigration;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your need!
*/
class Version20130518115055 extends AbstractMigration
{
public function up(Schema $schema)
{
// 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("DROP TABLE migrations");
$this->addSql("ALTER TABLE config DROP FOREIGN KEY FK_D48A2F7CF0C46DC5");
$this->addSql("ALTER TABLE config ADD CONSTRAINT FK_D48A2F7CF0C46DC5 FOREIGN KEY (mandator_id) REFERENCES `mandator` (mandator_id)");
$this->addSql("ALTER TABLE user DROP FOREIGN KEY FK_8D93D649F0C46DC5");
$this->addSql("ALTER TABLE user ADD CONSTRAINT FK_8D93D649F0C46DC5 FOREIGN KEY (mandator_id) REFERENCES `mandator` (mandator_id)");
$this->addSql("ALTER TABLE user_has_role DROP FOREIGN KEY FK_EAB8B535D60322AC");
$this->addSql("ALTER TABLE user_has_role DROP FOREIGN KEY FK_EAB8B535A76ED395");
$this->addSql("ALTER TABLE user_has_role ADD CONSTRAINT FK_EAB8B535D60322AC FOREIGN KEY (role_id) REFERENCES `role` (role_id)");
$this->addSql("ALTER TABLE user_has_role ADD CONSTRAINT FK_EAB8B535A76ED395 FOREIGN KEY (user_id) REFERENCES `user` (user_id)");
$this->addSql("ALTER TABLE calendar DROP FOREIGN KEY FK_6EA9A146CC481A2F");
$this->addSql("ALTER TABLE calendar DROP FOREIGN KEY FK_6EA9A146F0C46DC5");
$this->addSql("ALTER TABLE calendar ADD CONSTRAINT FK_6EA9A146CC481A2F FOREIGN KEY (calender_layout_id) REFERENCES `calendar_layout` (calender_layout_id)");
$this->addSql("ALTER TABLE calendar ADD CONSTRAINT FK_6EA9A146F0C46DC5 FOREIGN KEY (mandator_id) REFERENCES `mandator` (mandator_id)");
$this->addSql("ALTER TABLE milestone DROP FOREIGN KEY FK_4FAC838271F7E88B");
$this->addSql("ALTER TABLE milestone ADD CONSTRAINT FK_4FAC838271F7E88B FOREIGN KEY (event_id) REFERENCES `event` (event_id)");
$this->addSql("ALTER TABLE message DROP FOREIGN KEY FK_B6BD307FE559DFD1");
$this->addSql("ALTER TABLE message ADD `use_in_javascript` TINYINT(1) NOT NULL");
$this->addSql("ALTER TABLE message ADD CONSTRAINT FK_B6BD307FE559DFD1 FOREIGN KEY (locale_id) REFERENCES `locale` (locale_id)");
$this->addSql("ALTER TABLE tab DROP FOREIGN KEY FK_73E3430C9D1F3581");
$this->addSql("ALTER TABLE tab DROP FOREIGN KEY FK_73E3430CA40A2C8");
$this->addSql("ALTER TABLE tab ADD CONSTRAINT FK_73E3430C9D1F3581 FOREIGN KEY (versionset_id) REFERENCES `versionset` (versionset_id)");
$this->addSql("ALTER TABLE tab ADD CONSTRAINT FK_73E3430CA40A2C8 FOREIGN KEY (calendar_id) REFERENCES `calendar` (calendar_id)");
$this->addSql("ALTER TABLE mandator DROP FOREIGN KEY FK_D14DA567E559DFD1");
$this->addSql("ALTER TABLE mandator ADD CONSTRAINT FK_D14DA567E559DFD1 FOREIGN KEY (locale_id) REFERENCES `locale` (locale_id) ON DELETE CASCADE");
$this->addSql("ALTER TABLE versionset DROP FOREIGN KEY FK_CBE9C7E9A40A2C8");
$this->addSql("ALTER TABLE versionset ADD CONSTRAINT FK_CBE9C7E9A40A2C8 FOREIGN KEY (calendar_id) REFERENCES `calendar` (calendar_id)");
$this->addSql("ALTER TABLE role_has_permission DROP FOREIGN KEY FK_6F82580FD60322AC");
$this->addSql("ALTER TABLE role_has_permission DROP FOREIGN KEY FK_6F82580FFED90CCA");
$this->addSql("ALTER TABLE role_has_permission ADD CONSTRAINT FK_6F82580FD60322AC FOREIGN KEY (role_id) REFERENCES `role` (role_id)");
$this->addSql("ALTER TABLE role_has_permission ADD CONSTRAINT FK_6F82580FFED90CCA FOREIGN KEY (permission_id) REFERENCES `permission` (permission_id)");
$this->addSql("ALTER TABLE field DROP FOREIGN KEY FK_5BF545588D0C9323");
$this->addSql("ALTER TABLE field DROP FOREIGN KEY FK_5BF54558727ACA70");
$this->addSql("ALTER TABLE field DROP FOREIGN KEY FK_5BF545589D1F3581");
$this->addSql("ALTER TABLE field ADD CONSTRAINT FK_5BF545588D0C9323 FOREIGN KEY (tab_id) REFERENCES `tab` (tab_id)");
$this->addSql("ALTER TABLE field ADD CONSTRAINT FK_5BF54558727ACA70 FOREIGN KEY (parent_id) REFERENCES `field` (field_id)");
$this->addSql("ALTER TABLE field ADD CONSTRAINT FK_5BF545589D1F3581 FOREIGN KEY (versionset_id) REFERENCES `versionset` (versionset_id)");
$this->addSql("ALTER TABLE event DROP FOREIGN KEY FK_3BAE0AA79D1F3581");
$this->addSql("ALTER TABLE event DROP FOREIGN KEY FK_3BAE0AA7443707B0");
$this->addSql("ALTER TABLE event DROP FOREIGN KEY FK_3BAE0AA7A40A2C8");
$this->addSql("ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA79D1F3581 FOREIGN KEY (versionset_id) REFERENCES `versionset` (versionset_id)");
$this->addSql("ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA7443707B0 FOREIGN KEY (field_id) REFERENCES `field` (field_id)");
$this->addSql("ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA7A40A2C8 FOREIGN KEY (calendar_id) REFERENCES `calendar` (calendar_id)");
$this->addSql("ALTER TABLE rating DROP FOREIGN KEY FK_D889262271F7E88B");
$this->addSql("ALTER TABLE rating DROP FOREIGN KEY FK_D8892622443707B0");
$this->addSql("ALTER TABLE rating DROP FOREIGN KEY FK_D88926229D1F3581");
$this->addSql("ALTER TABLE rating ADD CONSTRAINT FK_D889262271F7E88B FOREIGN KEY (event_id) REFERENCES `event` (event_id)");
$this->addSql("ALTER TABLE rating ADD CONSTRAINT FK_D8892622443707B0 FOREIGN KEY (field_id) REFERENCES `field` (field_id)");
$this->addSql("ALTER TABLE rating ADD CONSTRAINT FK_D88926229D1F3581 FOREIGN KEY (versionset_id) REFERENCES `versionset` (versionset_id)");
$this->addSql("ALTER TABLE role DROP FOREIGN KEY FK_57698A6AA44B56EA");
$this->addSql("ALTER TABLE role ADD CONSTRAINT FK_57698A6AA44B56EA FOREIGN KEY (parent_role_id) REFERENCES `role` (role_id)");
}
public function down(Schema $schema)
{
// 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("CREATE TABLE migrations (version VARCHAR(255) NOT NULL, PRIMARY KEY(version)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB");
$this->addSql("ALTER TABLE calendar DROP FOREIGN KEY FK_6EA9A146F0C46DC5");
$this->addSql("ALTER TABLE calendar DROP FOREIGN KEY FK_6EA9A146CC481A2F");
$this->addSql("ALTER TABLE calendar ADD CONSTRAINT FK_6EA9A146F0C46DC5 FOREIGN KEY (mandator_id) REFERENCES mandator (mandator_id)");
$this->addSql("ALTER TABLE calendar ADD CONSTRAINT FK_6EA9A146CC481A2F FOREIGN KEY (calender_layout_id) REFERENCES calendar_layout (calender_layout_id)");
$this->addSql("ALTER TABLE config DROP FOREIGN KEY FK_D48A2F7CF0C46DC5");
$this->addSql("ALTER TABLE config ADD CONSTRAINT FK_D48A2F7CF0C46DC5 FOREIGN KEY (mandator_id) REFERENCES mandator (mandator_id)");
$this->addSql("ALTER TABLE event DROP FOREIGN KEY FK_3BAE0AA7A40A2C8");
$this->addSql("ALTER TABLE event DROP FOREIGN KEY FK_3BAE0AA79D1F3581");
$this->addSql("ALTER TABLE event DROP FOREIGN KEY FK_3BAE0AA7443707B0");
$this->addSql("ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA7A40A2C8 FOREIGN KEY (calendar_id) REFERENCES calendar (calendar_id)");
$this->addSql("ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA79D1F3581 FOREIGN KEY (versionset_id) REFERENCES versionset (versionset_id)");
$this->addSql("ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA7443707B0 FOREIGN KEY (field_id) REFERENCES field (field_id)");
$this->addSql("ALTER TABLE field DROP FOREIGN KEY FK_5BF545588D0C9323");
$this->addSql("ALTER TABLE field DROP FOREIGN KEY FK_5BF545589D1F3581");
$this->addSql("ALTER TABLE field DROP FOREIGN KEY FK_5BF54558727ACA70");
$this->addSql("ALTER TABLE field ADD CONSTRAINT FK_5BF545588D0C9323 FOREIGN KEY (tab_id) REFERENCES tab (tab_id)");
$this->addSql("ALTER TABLE field ADD CONSTRAINT FK_5BF545589D1F3581 FOREIGN KEY (versionset_id) REFERENCES versionset (versionset_id)");
$this->addSql("ALTER TABLE field ADD CONSTRAINT FK_5BF54558727ACA70 FOREIGN KEY (parent_id) REFERENCES field (field_id)");
$this->addSql("ALTER TABLE mandator DROP FOREIGN KEY FK_D14DA567E559DFD1");
$this->addSql("ALTER TABLE mandator ADD CONSTRAINT FK_D14DA567E559DFD1 FOREIGN KEY (locale_id) REFERENCES locale (locale_id) ON DELETE CASCADE");
$this->addSql("ALTER TABLE message DROP FOREIGN KEY FK_B6BD307FE559DFD1");
$this->addSql("ALTER TABLE message DROP `use_in_javascript`");
$this->addSql("ALTER TABLE message ADD CONSTRAINT FK_B6BD307FE559DFD1 FOREIGN KEY (locale_id) REFERENCES locale (locale_id)");
$this->addSql("ALTER TABLE milestone DROP FOREIGN KEY FK_4FAC838271F7E88B");
$this->addSql("ALTER TABLE milestone ADD CONSTRAINT FK_4FAC838271F7E88B FOREIGN KEY (event_id) REFERENCES event (event_id)");
$this->addSql("ALTER TABLE rating DROP FOREIGN KEY FK_D889262271F7E88B");
$this->addSql("ALTER TABLE rating DROP FOREIGN KEY FK_D88926229D1F3581");
$this->addSql("ALTER TABLE rating DROP FOREIGN KEY FK_D8892622443707B0");
$this->addSql("ALTER TABLE rating ADD CONSTRAINT FK_D889262271F7E88B FOREIGN KEY (event_id) REFERENCES event (event_id)");
$this->addSql("ALTER TABLE rating ADD CONSTRAINT FK_D88926229D1F3581 FOREIGN KEY (versionset_id) REFERENCES versionset (versionset_id)");
$this->addSql("ALTER TABLE rating ADD CONSTRAINT FK_D8892622443707B0 FOREIGN KEY (field_id) REFERENCES field (field_id)");
$this->addSql("ALTER TABLE role DROP FOREIGN KEY FK_57698A6AA44B56EA");
$this->addSql("ALTER TABLE role ADD CONSTRAINT FK_57698A6AA44B56EA FOREIGN KEY (parent_role_id) REFERENCES role (role_id)");
$this->addSql("ALTER TABLE role_has_permission DROP FOREIGN KEY FK_6F82580FD60322AC");
$this->addSql("ALTER TABLE role_has_permission DROP FOREIGN KEY FK_6F82580FFED90CCA");
$this->addSql("ALTER TABLE role_has_permission ADD CONSTRAINT FK_6F82580FD60322AC FOREIGN KEY (role_id) REFERENCES role (role_id)");
$this->addSql("ALTER TABLE role_has_permission ADD CONSTRAINT FK_6F82580FFED90CCA FOREIGN KEY (permission_id) REFERENCES permission (permission_id)");
$this->addSql("ALTER TABLE tab DROP FOREIGN KEY FK_73E3430C9D1F3581");
$this->addSql("ALTER TABLE tab DROP FOREIGN KEY FK_73E3430CA40A2C8");
$this->addSql("ALTER TABLE tab ADD CONSTRAINT FK_73E3430C9D1F3581 FOREIGN KEY (versionset_id) REFERENCES versionset (versionset_id)");
$this->addSql("ALTER TABLE tab ADD CONSTRAINT FK_73E3430CA40A2C8 FOREIGN KEY (calendar_id) REFERENCES calendar (calendar_id)");
$this->addSql("ALTER TABLE user DROP FOREIGN KEY FK_8D93D649F0C46DC5");
$this->addSql("ALTER TABLE user ADD CONSTRAINT FK_8D93D649F0C46DC5 FOREIGN KEY (mandator_id) REFERENCES mandator (mandator_id)");
$this->addSql("ALTER TABLE user_has_role DROP FOREIGN KEY FK_EAB8B535A76ED395");
$this->addSql("ALTER TABLE user_has_role DROP FOREIGN KEY FK_EAB8B535D60322AC");
$this->addSql("ALTER TABLE user_has_role ADD CONSTRAINT FK_EAB8B535A76ED395 FOREIGN KEY (user_id) REFERENCES user (user_id)");
$this->addSql("ALTER TABLE user_has_role ADD CONSTRAINT FK_EAB8B535D60322AC FOREIGN KEY (role_id) REFERENCES role (role_id)");
$this->addSql("ALTER TABLE versionset DROP FOREIGN KEY FK_CBE9C7E9A40A2C8");
$this->addSql("ALTER TABLE versionset ADD CONSTRAINT FK_CBE9C7E9A40A2C8 FOREIGN KEY (calendar_id) REFERENCES calendar (calendar_id)");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment