port 4.1: migrate field type text to string

This commit is contained in:
aina-esokia
2019-01-11 14:45:33 +04:00
parent 8c41dc28c7
commit d2bdd2ed4a
11 changed files with 70 additions and 10 deletions

View File

@@ -16,7 +16,7 @@ class Version
/** /**
* @var string * @var string
*/ */
private $number = '4.1.0-alpha.13b'; private $number = '4.1.0-alpha.14a';
/** /**
* @var string * @var string

View File

@@ -89,7 +89,6 @@ class Field implements Typed
case databox_field::TYPE_NUMBER: case databox_field::TYPE_NUMBER:
return FieldMapping::TYPE_DOUBLE; return FieldMapping::TYPE_DOUBLE;
case databox_field::TYPE_STRING: case databox_field::TYPE_STRING:
case databox_field::TYPE_TEXT:
return FieldMapping::TYPE_STRING; return FieldMapping::TYPE_STRING;
} }

View File

@@ -446,7 +446,6 @@ class databox extends base implements ThumbnailedElement
databox_field::TYPE_DATE databox_field::TYPE_DATE
, databox_field::TYPE_NUMBER , databox_field::TYPE_NUMBER
, databox_field::TYPE_STRING , databox_field::TYPE_STRING
, databox_field::TYPE_TEXT
] ]
) ? $type : databox_field::TYPE_STRING; ) ? $type : databox_field::TYPE_STRING;

View File

@@ -100,7 +100,6 @@ class databox_field implements cache_cacheableInterface
protected $original_dces; protected $original_dces;
protected $aggregable; protected $aggregable;
const TYPE_TEXT = "text";
const TYPE_DATE = "date"; const TYPE_DATE = "date";
const TYPE_STRING = "string"; const TYPE_STRING = "string";
const TYPE_NUMBER = "number"; const TYPE_NUMBER = "number";

View 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;
}
}

View File

@@ -1901,7 +1901,7 @@
</field> </field>
<field> <field>
<name>type</name> <name>type</name>
<type>enum('string','text','date','number')</type> <type>enum('string','date','number')</type>
<null></null> <null></null>
<extra></extra> <extra></extra>
<default></default> <default></default>

View File

@@ -198,7 +198,7 @@
<Coverage src="XMP-dc:Coverage" report="1" /> <Coverage src="XMP-dc:Coverage" report="1" />
<Rights src="XMP-dc:Rights" report="0" /> <Rights src="XMP-dc:Rights" report="0" />
<Comments src="" business="1" 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" /> <CameraDevice src="IFD0:Model" readonly="1" report="0" />
<Latitude src="GPS:GPSLatitude" readonly="1" report="0" /> <Latitude src="GPS:GPSLatitude" readonly="1" report="0" />
<Longitude src="GPS:GPSLongitude" readonly="1" report="0"/> <Longitude src="GPS:GPSLongitude" readonly="1" report="0"/>

View File

@@ -202,7 +202,7 @@
<Longitude src="GPS:GPSLongitude" readonly="1"/> <Longitude src="GPS:GPSLongitude" readonly="1"/>
<Latitude src="GPS:GPSLatitude" readonly="1"/> <Latitude src="GPS:GPSLatitude" readonly="1"/>
<CameraModel src="IFD0:Model" 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> </description>
<statbits> <statbits>

View File

@@ -202,7 +202,7 @@
<Longitude src="GPS:GPSLongitude" readonly="1"/> <Longitude src="GPS:GPSLongitude" readonly="1"/>
<Latitude src="GPS:GPSLatitude" readonly="1"/> <Latitude src="GPS:GPSLatitude" readonly="1"/>
<AppareilPhoto src="IFD0:Model" 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> </description>
<statbits> <statbits>

View File

@@ -130,7 +130,6 @@
<select id="type"> <select id="type">
<option <%= field.type == '' ? 'selected' : '' %> value=""></option> <option <%= field.type == '' ? 'selected' : '' %> value=""></option>
<option <%= field.type == 'string' ? 'selected' : '' %> value="string">string</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 == 'number' ? 'selected' : '' %> value="number">number</option>
<option <%= field.type == 'date' ? 'selected' : '' %> value="date">date</option> <option <%= field.type == 'date' ? 'selected' : '' %> value="date">date</option>
</select> </select>

View File

@@ -742,7 +742,7 @@ class ApiJsonTest extends ApiTestCase
} }
$this->assertTrue(is_string($metadatas['thesaurus_branch'])); $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['indexable']));
$this->assertTrue(is_bool($metadatas['multivalue'])); $this->assertTrue(is_bool($metadatas['multivalue']));
$this->assertTrue(is_bool($metadatas['readonly'])); $this->assertTrue(is_bool($metadatas['readonly']));