Code Duplication    Length = 44-44 lines in 2 locations

lib/Migration/Version0019Date20200713184401.php 1 location

@@ 46-89 (lines=44) @@
43
 *
44
 * @package OCA\Circles\Migration
45
 */
46
class Version0019Date20200713184401 extends SimpleMigrationStep {
47
48
49
	/** @var IDBConnection */
50
	private $connection;
51
52
53
	/**
54
	 * @param IDBConnection $connection
55
	 */
56
	public function __construct(IDBConnection $connection) {
57
		$this->connection = $connection;
58
	}
59
60
61
	/**
62
	 * @param IOutput $output
63
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
64
	 * @param array $options
65
	 *
66
	 * @return null|ISchemaWrapper
67
	 * @throws SchemaException
68
	 */
69
	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
70
		/** @var ISchemaWrapper $schema */
71
		$schema = $schemaClosure();
72
73
		if ($schema->hasTable('circle_members')) {
74
			$table = $schema->getTable('circle_members');
75
			if (!$table->hasColumn('cached_name')) {
76
				$table->addColumn(
77
					'cached_name', 'string', [
78
									  'notnull' => true,
79
									  'length'  => 255,
80
									  'default' => ''
81
								  ]
82
				);
83
			}
84
		}
85
86
		return $schema;
87
	}
88
89
}
90

lib/Migration/Version0019Date20200726125713.php 1 location

@@ 47-90 (lines=44) @@
44
 *
45
 * @package OCA\Circles\Migration
46
 */
47
class Version0019Date20200726125713 extends SimpleMigrationStep {
48
49
50
	/** @var IDBConnection */
51
	private $connection;
52
53
54
	/**
55
	 * @param IDBConnection $connection
56
	 */
57
	public function __construct(IDBConnection $connection) {
58
		$this->connection = $connection;
59
	}
60
61
62
	/**
63
	 * @param IOutput $output
64
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
65
	 * @param array $options
66
	 *
67
	 * @return null|ISchemaWrapper
68
	 * @throws SchemaException
69
	 */
70
	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
71
		/** @var ISchemaWrapper $schema */
72
		$schema = $schemaClosure();
73
74
		if ($schema->hasTable('circle_circles')) {
75
			$table = $schema->getTable('circle_circles');
76
			if (!$table->hasColumn('alt_name')) {
77
				$table->addColumn(
78
					'alt_name', 'string', [
79
								  'notnull' => true,
80
								  'length'  => 127,
81
								  'default' => ''
82
							  ]
83
				);
84
			}
85
		}
86
87
		return $schema;
88
	}
89
90
}
91
92