1
0
Fork 0
mirror of https://github.com/Oreolek/kangana.git synced 2024-05-05 02:28:17 +03:00

Issue #5: new fields for Client model/table

This commit is contained in:
Alexander Yakovlev 2016-10-23 12:19:05 +07:00
parent d15a4064e7
commit 2b5c90408f
3 changed files with 49 additions and 8 deletions

View file

@ -36,6 +36,18 @@ class Model_Client extends ORM {
array('not_empty'),
array('min_length', array(':value', 5)),
),
'sex' => array(
array('max_length', array(':value', 1)),
),
'referrer' => array(
array('max_length', array(':value', 255)),
),
'city' => array(
array('max_length', array(':value', 255)),
),
'country' => array(
array('max_length', array(':value', 255)),
),
);
}

View file

@ -0,0 +1,29 @@
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* new client fields
*/
class Migration_Kangana_20161023121040 extends Minion_Migration_Base {
public function up(Kohana_Database $db)
{
$db->query(NULL, 'ALTER TABLE clients ADD COLUMN sex CHAR(1) NULL ');
$db->query(NULL, 'ALTER TABLE clients ADD COLUMN referrer VARCHAR(255) NULL ');
$db->query(NULL, 'ALTER TABLE clients ADD COLUMN city VARCHAR(255) NULL ');
$db->query(NULL, 'ALTER TABLE clients ADD COLUMN country VARCHAR(255) NULL ');
}
/**
* Run queries needed to remove this migration
*
* @param Kohana_Database $db Database connection
*/
public function down(Kohana_Database $db)
{
$db->query(NULL, 'ALTER TABLE clients DROP COLUMN sex');
$db->query(NULL, 'ALTER TABLE clients DROP COLUMN referrer');
$db->query(NULL, 'ALTER TABLE clients DROP COLUMN city');
$db->query(NULL, 'ALTER TABLE clients DROP COLUMN country');
}
}

16
composer.lock generated
View file

@ -1261,12 +1261,12 @@
"source": {
"type": "git",
"url": "https://github.com/phingofficial/phing.git",
"reference": "62d357097ed0e6006f5c97c5352e445274199c3f"
"reference": "a7c32b2daa5e4e5a9de6f79ad2351daa5e2d1ace"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phingofficial/phing/zipball/62d357097ed0e6006f5c97c5352e445274199c3f",
"reference": "62d357097ed0e6006f5c97c5352e445274199c3f",
"url": "https://api.github.com/repos/phingofficial/phing/zipball/a7c32b2daa5e4e5a9de6f79ad2351daa5e2d1ace",
"reference": "a7c32b2daa5e4e5a9de6f79ad2351daa5e2d1ace",
"shasum": ""
},
"require": {
@ -1346,7 +1346,7 @@
"task",
"tool"
],
"time": "2016-10-18 19:52:52"
"time": "2016-10-21 09:54:47"
},
{
"name": "phpdocumentor/reflection-common",
@ -2381,12 +2381,12 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "f3abbc0c63c0c7803db79a7398bb983e5b089f53"
"reference": "3d42c56f989688ad0790dcdc3c706d60748af6a6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/f3abbc0c63c0c7803db79a7398bb983e5b089f53",
"reference": "f3abbc0c63c0c7803db79a7398bb983e5b089f53",
"url": "https://api.github.com/repos/symfony/yaml/zipball/3d42c56f989688ad0790dcdc3c706d60748af6a6",
"reference": "3d42c56f989688ad0790dcdc3c706d60748af6a6",
"shasum": ""
},
"require": {
@ -2428,7 +2428,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2016-09-28 14:20:56"
"time": "2016-10-21 21:10:51"
},
{
"name": "webmozart/assert",