Guest User

Untitled

a guest
Jun 12th, 2016
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.91 KB | None | 0 0
  1. <?php
  2.  
  3. use Propel\Generator\Manager\MigrationManager;
  4.  
  5. /**
  6.  * Data object containing the SQL and PHP code to migrate the database
  7.  * up to version 1465748871.
  8.  */
  9. class PropelMigration_1465748871
  10. {
  11.     public $comment = '';
  12.  
  13.     public function preUp(MigrationManager $manager)
  14.     {
  15.         // add the pre-migration code here
  16.     }
  17.  
  18.     public function postUp(MigrationManager $manager)
  19.     {
  20.         // add the post-migration code here
  21.     }
  22.  
  23.     public function preDown(MigrationManager $manager)
  24.     {
  25.         // add the pre-migration code here
  26.     }
  27.  
  28.     public function postDown(MigrationManager $manager)
  29.     {
  30.         // add the post-migration code here
  31.     }
  32.  
  33.     /**
  34.      * Get the SQL statements for the Up migration
  35.      *
  36.      * @return array list of the SQL strings to execute for the Up migration
  37.      *               the keys being the datasources
  38.      */
  39.     public function getUpSQL()
  40.     {
  41.         return array (
  42.   'default' => '
  43. BEGIN;
  44.  
  45. ALTER TABLE "product"
  46.  
  47.  ADD "id_product" bigserial NOT NULL,
  48.  
  49.  ADD "id_product_barcode" INT8,
  50.  
  51.  ADD "name" VARCHAR(200) NOT NULL,
  52.  
  53.  ADD "id_product_manufacturer" INTEGER NOT NULL,
  54.  
  55.  ADD "id_product_category" INTEGER NOT NULL,
  56.  
  57.  ADD "id_product_photo" INT8,
  58.  
  59.  ADD PRIMARY KEY ("id_product");
  60.  
  61. COMMIT;
  62. ',
  63. );
  64.     }
  65.  
  66.     /**
  67.      * Get the SQL statements for the Down migration
  68.      *
  69.      * @return array list of the SQL strings to execute for the Down migration
  70.      *               the keys being the datasources
  71.      */
  72.     public function getDownSQL()
  73.     {
  74.         return array (
  75.   'default' => '
  76. BEGIN;
  77.  
  78. ALTER TABLE "product"
  79.  
  80.  DROP CONSTRAINT "product_pkey",
  81.  
  82.  DROP COLUMN "id_product",
  83.  
  84.  DROP COLUMN "id_product_barcode",
  85.  
  86.  DROP COLUMN "name",
  87.  
  88.  DROP COLUMN "id_product_manufacturer",
  89.  
  90.  DROP COLUMN "id_product_category",
  91.  
  92.  DROP COLUMN "id_product_photo";
  93.  
  94. COMMIT;
  95. ',
  96. );
  97.     }
  98.  
  99. }
Add Comment
Please, Sign In to add comment