mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
port 4.1: migrate field type text to string
This commit is contained in:
@@ -16,7 +16,7 @@ class Version
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $number = '4.1.0-alpha.13b';
|
||||
private $number = '4.1.0-alpha.14a';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
@@ -89,7 +89,6 @@ class Field implements Typed
|
||||
case databox_field::TYPE_NUMBER:
|
||||
return FieldMapping::TYPE_DOUBLE;
|
||||
case databox_field::TYPE_STRING:
|
||||
case databox_field::TYPE_TEXT:
|
||||
return FieldMapping::TYPE_STRING;
|
||||
}
|
||||
|
||||
|
@@ -446,7 +446,6 @@ class databox extends base implements ThumbnailedElement
|
||||
databox_field::TYPE_DATE
|
||||
, databox_field::TYPE_NUMBER
|
||||
, databox_field::TYPE_STRING
|
||||
, databox_field::TYPE_TEXT
|
||||
]
|
||||
) ? $type : databox_field::TYPE_STRING;
|
||||
|
||||
|
@@ -100,7 +100,6 @@ class databox_field implements cache_cacheableInterface
|
||||
protected $original_dces;
|
||||
protected $aggregable;
|
||||
|
||||
const TYPE_TEXT = "text";
|
||||
const TYPE_DATE = "date";
|
||||
const TYPE_STRING = "string";
|
||||
const TYPE_NUMBER = "number";
|
||||
|
64
lib/classes/patch/410alpha14a.php
Normal file
64
lib/classes/patch/410alpha14a.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2016 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
class patch_410alpha14a implements patchInterface
|
||||
{
|
||||
/** @var string */
|
||||
private $release = '4.1.0-alpha.14a';
|
||||
|
||||
/** @var array */
|
||||
private $concern = [base::DATA_BOX];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_release()
|
||||
{
|
||||
return $this->release;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDoctrineMigrations()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function require_all_upgrades()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function concern()
|
||||
{
|
||||
return $this->concern;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function apply(base $databox, Application $app)
|
||||
{
|
||||
$sql = "UPDATE metadatas_structure SET type = 'string' where type = 'text' OR type = '' ";
|
||||
$databox->get_connection()->executeQuery($sql);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -1901,7 +1901,7 @@
|
||||
</field>
|
||||
<field>
|
||||
<name>type</name>
|
||||
<type>enum('string','text','date','number')</type>
|
||||
<type>enum('string','date','number')</type>
|
||||
<null></null>
|
||||
<extra></extra>
|
||||
<default></default>
|
||||
|
@@ -198,7 +198,7 @@
|
||||
<Coverage src="XMP-dc:Coverage" report="1" />
|
||||
<Rights src="XMP-dc:Rights" report="0" />
|
||||
<Comments src="" business="1" report="0" />
|
||||
<Filename src="Phraseanet:tf-basename" readonly="1" type="text" report="1"/>
|
||||
<Filename src="Phraseanet:tf-basename" readonly="1" type="string" report="1"/>
|
||||
<CameraDevice src="IFD0:Model" readonly="1" report="0" />
|
||||
<Latitude src="GPS:GPSLatitude" readonly="1" report="0" />
|
||||
<Longitude src="GPS:GPSLongitude" readonly="1" report="0"/>
|
||||
|
@@ -202,7 +202,7 @@
|
||||
<Longitude src="GPS:GPSLongitude" readonly="1"/>
|
||||
<Latitude src="GPS:GPSLatitude" readonly="1"/>
|
||||
<CameraModel src="IFD0:Model" readonly="1"/>
|
||||
<FileName src="Phraseanet:tf-basename" readonly="1" type="text" />
|
||||
<FileName src="Phraseanet:tf-basename" readonly="1" type="string" />
|
||||
</description>
|
||||
|
||||
<statbits>
|
||||
|
@@ -202,7 +202,7 @@
|
||||
<Longitude src="GPS:GPSLongitude" readonly="1"/>
|
||||
<Latitude src="GPS:GPSLatitude" readonly="1"/>
|
||||
<AppareilPhoto src="IFD0:Model" readonly="1"/>
|
||||
<NomDeFichier src="Phraseanet:tf-basename" readonly="1" type="text" />
|
||||
<NomDeFichier src="Phraseanet:tf-basename" readonly="1" type="string" />
|
||||
</description>
|
||||
|
||||
<statbits>
|
||||
|
@@ -130,7 +130,6 @@
|
||||
<select id="type">
|
||||
<option <%= field.type == '' ? 'selected' : '' %> value=""></option>
|
||||
<option <%= field.type == 'string' ? 'selected' : '' %> value="string">string</option>
|
||||
<option <%= field.type == 'text' ? 'selected' : '' %> value="text">text</option>
|
||||
<option <%= field.type == 'number' ? 'selected' : '' %> value="number">number</option>
|
||||
<option <%= field.type == 'date' ? 'selected' : '' %> value="date">date</option>
|
||||
</select>
|
||||
|
@@ -742,7 +742,7 @@ class ApiJsonTest extends ApiTestCase
|
||||
}
|
||||
|
||||
$this->assertTrue(is_string($metadatas['thesaurus_branch']));
|
||||
$this->assertTrue(in_array($metadatas['type'], [\databox_field::TYPE_DATE, \databox_field::TYPE_STRING, \databox_field::TYPE_NUMBER, \databox_field::TYPE_TEXT]));
|
||||
$this->assertTrue(in_array($metadatas['type'], [\databox_field::TYPE_DATE, \databox_field::TYPE_STRING, \databox_field::TYPE_NUMBER]));
|
||||
$this->assertTrue(is_bool($metadatas['indexable']));
|
||||
$this->assertTrue(is_bool($metadatas['multivalue']));
|
||||
$this->assertTrue(is_bool($metadatas['readonly']));
|
||||
|
Reference in New Issue
Block a user