Migration_Driver::change_column()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
c 0
b 0
f 0
nc 1
1
<?php defined('SYSPATH') OR die('No direct script access.');
2
3
abstract class Migration_Driver
4
{
5
6
	/**
7
	 * Get the driver of a srtain type
8
	 * @param type $type
0 ignored issues
show
Bug introduced by
There is no parameter named $type. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
9
	 * @return type
10
	 */
11
	static public function factory($database = 'default')
12
	{
13
		$config = Kohana::$config->load("database.$database");
14
15
		if ( ! $config)
16
			throw new Migration_Exception("Configuration :database for database does not exist", array(':database' => $database));
17
18
		// Set the driver class name
19 13
		$driver_name = in_array($config['type'], array('PDO', 'MySQL')) ? 'Mysql' : ucfirst($config['type']);
20
		$driver = 'Migration_Driver_'.$driver_name;
21 13
22
		if ( ! class_exists($driver))
23 13
			throw new Migration_Exception("Driver :type does not exist (class :driver)", array(':type' => $config['type'], ':driver' => $driver));
24 13
25
		// Create the database driver instance
26
		return new $driver($database);
27 13
	}
28 13
29
	protected $versions = null;
30 13
	protected $_affected_rows = NULL;
31 13
32
	public function __construct($config)
33
	{
34 13
		$class = get_class($this).'_Versions';
35
		$this->versions = $class($this);
36
	}
37
38
	public function affected_rows()
39
	{
40
		return $this->_affected_rows;
41
	}
42
	/**
43
	 * Get or set the current versions
44
	 */
45
	public function versions(Migration_Driver_Versions $versions = NULL)
46 1
	{
47
		if ($versions == NULL)
48 1
		{
49
			return $this->versions;
50
		}
51
		else
52
		{
53 1
			$this->versions = $versions;
54
		}
55 1
		return $this;
56 1
	}
57 1
58
	abstract public function clear_all();
59
60
	abstract public function table($name);
61
	abstract public function column($name);
62
	abstract public function quote($string);
63
64
	abstract public function create_table($table_name, $fields, $primary_key = TRUE);
65
	abstract public function drop_table($table_name);
66
	abstract public function change_table($table_name, $options);
67
	abstract public function rename_table($old_name, $new_name);
68
69
	abstract public function add_column($table_name, $column_name, $params);
70
	abstract public function remove_column($table_name, $column_name);
71
	abstract public function change_column($table_name, $column_name, $params);
72
	abstract public function rename_column($table_name, $column_name, $new_column_name);
73
74
	abstract public function add_index($table_name, $index_name, $columns, $index_type = 'normal');
75
	abstract public function remove_index($table_name, $index_name);
76
}
77