Commit 730b469453def692a0ce8c86f83694b14bfab55b

Authored by Alex Savenko
1 parent 7f34ea2a

phalcon migration generate

app/migrations/1.0.1/album.php 0 → 100644
  1 +<?php
  2 +
  3 +use Phalcon\Db\Column;
  4 +use Phalcon\Db\Index;
  5 +use Phalcon\Db\Reference;
  6 +use Phalcon\Mvc\Model\Migration;
  7 +
  8 +/**
  9 + * Class AlbumMigration_101
  10 + */
  11 +class AlbumMigration_101 extends Migration
  12 +{
  13 + /**
  14 + * Define the table structure
  15 + *
  16 + * @return void
  17 + */
  18 + public function morph()
  19 + {
  20 + $this->morphTable('album', [
  21 + 'columns' => [
  22 + new Column(
  23 + 'id',
  24 + [
  25 + 'type' => Column::TYPE_INTEGER,
  26 + 'notNull' => true,
  27 + 'autoIncrement' => true,
  28 + 'first' => true
  29 + ]
  30 + ),
  31 + new Column(
  32 + 'title',
  33 + [
  34 + 'type' => Column::TYPE_VARCHAR,
  35 + 'size' => 255,
  36 + 'after' => 'id'
  37 + ]
  38 + ),
  39 + new Column(
  40 + 'created_at',
  41 + [
  42 + 'type' => Column::TYPE_TIMESTAMP,
  43 + 'size' => 1,
  44 + 'after' => 'title'
  45 + ]
  46 + ),
  47 + new Column(
  48 + 'updated_at',
  49 + [
  50 + 'type' => Column::TYPE_TIMESTAMP,
  51 + 'size' => 1,
  52 + 'after' => 'created_at'
  53 + ]
  54 + )
  55 + ],
  56 + 'indexes' => [
  57 + new Index('album_pkey', ['id'], null)
  58 + ],
  59 + ]
  60 + );
  61 + }
  62 +
  63 + /**
  64 + * Run the migrations
  65 + *
  66 + * @return void
  67 + */
  68 + public function up()
  69 + {
  70 +
  71 + }
  72 +
  73 + /**
  74 + * Reverse the migrations
  75 + *
  76 + * @return void
  77 + */
  78 + public function down()
  79 + {
  80 +
  81 + }
  82 +
  83 +}
... ...
app/migrations/1.0.1/photo.php 0 → 100644
  1 +<?php
  2 +
  3 +use Phalcon\Db\Column;
  4 +use Phalcon\Db\Index;
  5 +use Phalcon\Db\Reference;
  6 +use Phalcon\Mvc\Model\Migration;
  7 +
  8 +/**
  9 + * Class PhotoMigration_101
  10 + */
  11 +class PhotoMigration_101 extends Migration
  12 +{
  13 + /**
  14 + * Define the table structure
  15 + *
  16 + * @return void
  17 + */
  18 + public function morph()
  19 + {
  20 + $this->morphTable('photo', [
  21 + 'columns' => [
  22 + new Column(
  23 + 'id',
  24 + [
  25 + 'type' => Column::TYPE_INTEGER,
  26 + 'notNull' => true,
  27 + 'autoIncrement' => true,
  28 + 'first' => true
  29 + ]
  30 + ),
  31 + new Column(
  32 + 'title',
  33 + [
  34 + 'type' => Column::TYPE_VARCHAR,
  35 + 'size' => 255,
  36 + 'after' => 'id'
  37 + ]
  38 + ),
  39 + new Column(
  40 + 'album_id',
  41 + [
  42 + 'type' => Column::TYPE_INTEGER,
  43 + 'after' => 'title'
  44 + ]
  45 + ),
  46 + new Column(
  47 + 'created_at',
  48 + [
  49 + 'type' => Column::TYPE_TIMESTAMP,
  50 + 'size' => 1,
  51 + 'after' => 'album_id'
  52 + ]
  53 + ),
  54 + new Column(
  55 + 'updated_at',
  56 + [
  57 + 'type' => Column::TYPE_TIMESTAMP,
  58 + 'size' => 1,
  59 + 'after' => 'created_at'
  60 + ]
  61 + )
  62 + ],
  63 + 'indexes' => [
  64 + new Index('photo_pkey', ['id'], null)
  65 + ],
  66 + 'references' => [
  67 + new Reference(
  68 + 'photo_album_id_fkey',
  69 + [
  70 + 'referencedTable' => 'album',
  71 + 'columns' => ['album_id'],
  72 + 'referencedColumns' => ['id'],
  73 + 'onUpdate' => '',
  74 + 'onDelete' => ''
  75 + ]
  76 + )
  77 + ],
  78 + ]
  79 + );
  80 + }
  81 +
  82 + /**
  83 + * Run the migrations
  84 + *
  85 + * @return void
  86 + */
  87 + public function up()
  88 + {
  89 +
  90 + }
  91 +
  92 + /**
  93 + * Reverse the migrations
  94 + *
  95 + * @return void
  96 + */
  97 + public function down()
  98 + {
  99 +
  100 + }
  101 +
  102 +}
... ...
app/migrations/1.0.1/project.php 0 → 100644
  1 +<?php
  2 +
  3 +use Phalcon\Db\Column;
  4 +use Phalcon\Db\Index;
  5 +use Phalcon\Db\Reference;
  6 +use Phalcon\Mvc\Model\Migration;
  7 +
  8 +/**
  9 + * Class ProjectMigration_101
  10 + */
  11 +class ProjectMigration_101 extends Migration
  12 +{
  13 + /**
  14 + * Define the table structure
  15 + *
  16 + * @return void
  17 + */
  18 + public function morph()
  19 + {
  20 + $this->morphTable('project', [
  21 + 'columns' => [
  22 + new Column(
  23 + 'id',
  24 + [
  25 + 'type' => Column::TYPE_INTEGER,
  26 + 'notNull' => true,
  27 + 'autoIncrement' => true,
  28 + 'first' => true
  29 + ]
  30 + ),
  31 + new Column(
  32 + 'name',
  33 + [
  34 + 'type' => Column::TYPE_VARCHAR,
  35 + 'size' => 255,
  36 + 'after' => 'id'
  37 + ]
  38 + ),
  39 + new Column(
  40 + 'user_id',
  41 + [
  42 + 'type' => Column::TYPE_INTEGER,
  43 + 'after' => 'name'
  44 + ]
  45 + ),
  46 + new Column(
  47 + 'created_at',
  48 + [
  49 + 'type' => Column::TYPE_TIMESTAMP,
  50 + 'size' => 1,
  51 + 'after' => 'user_id'
  52 + ]
  53 + ),
  54 + new Column(
  55 + 'updated_at',
  56 + [
  57 + 'type' => Column::TYPE_TIMESTAMP,
  58 + 'size' => 1,
  59 + 'after' => 'created_at'
  60 + ]
  61 + ),
  62 + new Column(
  63 + 'ga_view_id',
  64 + [
  65 + 'type' => Column::TYPE_INTEGER,
  66 + 'after' => 'updated_at'
  67 + ]
  68 + )
  69 + ],
  70 + 'indexes' => [
  71 + new Index('project_pkey', ['id'], null)
  72 + ],
  73 + 'references' => [
  74 + new Reference(
  75 + 'project_fkey_user_id',
  76 + [
  77 + 'referencedTable' => 'user',
  78 + 'columns' => ['user_id'],
  79 + 'referencedColumns' => ['id'],
  80 + 'onUpdate' => '',
  81 + 'onDelete' => ''
  82 + ]
  83 + )
  84 + ],
  85 + ]
  86 + );
  87 + }
  88 +
  89 + /**
  90 + * Run the migrations
  91 + *
  92 + * @return void
  93 + */
  94 + public function up()
  95 + {
  96 +
  97 + }
  98 +
  99 + /**
  100 + * Reverse the migrations
  101 + *
  102 + * @return void
  103 + */
  104 + public function down()
  105 + {
  106 +
  107 + }
  108 +
  109 +}
... ...
app/migrations/1.0.1/user.php 0 → 100644
  1 +<?php
  2 +
  3 +use Phalcon\Db\Column;
  4 +use Phalcon\Db\Index;
  5 +use Phalcon\Db\Reference;
  6 +use Phalcon\Mvc\Model\Migration;
  7 +
  8 +/**
  9 + * Class UserMigration_101
  10 + */
  11 +class UserMigration_101 extends Migration
  12 +{
  13 + /**
  14 + * Define the table structure
  15 + *
  16 + * @return void
  17 + */
  18 + public function morph()
  19 + {
  20 + $this->morphTable('user', [
  21 + 'columns' => [
  22 + new Column(
  23 + 'id',
  24 + [
  25 + 'type' => Column::TYPE_INTEGER,
  26 + 'notNull' => true,
  27 + 'autoIncrement' => true,
  28 + 'first' => true
  29 + ]
  30 + ),
  31 + new Column(
  32 + 'username',
  33 + [
  34 + 'type' => Column::TYPE_VARCHAR,
  35 + 'size' => 1,
  36 + 'after' => 'id'
  37 + ]
  38 + ),
  39 + new Column(
  40 + 'password',
  41 + [
  42 + 'type' => Column::TYPE_VARCHAR,
  43 + 'size' => 1,
  44 + 'after' => 'username'
  45 + ]
  46 + ),
  47 + new Column(
  48 + 'email',
  49 + [
  50 + 'type' => Column::TYPE_VARCHAR,
  51 + 'size' => 255,
  52 + 'after' => 'password'
  53 + ]
  54 + ),
  55 + new Column(
  56 + 'role',
  57 + [
  58 + 'type' => Column::TYPE_VARCHAR,
  59 + 'default' => "User",
  60 + 'notNull' => true,
  61 + 'size' => 1,
  62 + 'after' => 'email'
  63 + ]
  64 + ),
  65 + new Column(
  66 + 'created_at',
  67 + [
  68 + 'type' => Column::TYPE_TIMESTAMP,
  69 + 'size' => 1,
  70 + 'after' => 'role'
  71 + ]
  72 + ),
  73 + new Column(
  74 + 'updated_at',
  75 + [
  76 + 'type' => Column::TYPE_TIMESTAMP,
  77 + 'size' => 1,
  78 + 'after' => 'created_at'
  79 + ]
  80 + )
  81 + ],
  82 + 'indexes' => [
  83 + new Index('name_uniq', ['username'], null),
  84 + new Index('users_pkey', ['id'], null)
  85 + ],
  86 + ]
  87 + );
  88 + }
  89 +
  90 + /**
  91 + * Run the migrations
  92 + *
  93 + * @return void
  94 + */
  95 + public function up()
  96 + {
  97 +
  98 + }
  99 +
  100 + /**
  101 + * Reverse the migrations
  102 + *
  103 + * @return void
  104 + */
  105 + public function down()
  106 + {
  107 +
  108 + }
  109 +
  110 +}
... ...