Skip to content

Commit

Permalink
Sql regarding the Images module for migrating from v0.2 to v0.3 created.
Browse files Browse the repository at this point in the history
  • Loading branch information
kurko committed Jul 23, 2011
1 parent de481f5 commit 11774ab
Show file tree
Hide file tree
Showing 19 changed files with 109 additions and 209 deletions.
39 changes: 39 additions & 0 deletions docs/updating_aust/from_v0_2_to_v0_3
Expand Up @@ -143,3 +143,42 @@ Then:

DROP TABLE arquivos


From Imagens to Images
======================

Convert the structure module:

UPDATE categorias SET tipo='imagens' WHERE tipo='images'

Install the module. Move data to Files table:

INSERT INTO
images
(
node_id, title, title_encoded, subtitle, summary,
description, link, order_nr,
image_bytes, image_binary_data, image_name, image_type,
reference, reference_id,
local, class, specie,
created_on, expire_on, pageviews, admin_id,
image_path, image_systempath
)
(
SELECT
categoria, titulo, titulo_encoded, subtitulo, resumo,
texto, link, ordem,
bytes, dados, nome, tipo,
ref, ref_id,
local, classe, especie,
adddate, expiredate, visitantes, autor,
path, systempath
FROM
imagens
)


Then, terminate the old module:

DROP TABLE imagens

53 changes: 0 additions & 53 deletions modules/imagens/core/config/db_schema.php

This file was deleted.

This file was deleted.

10 changes: 5 additions & 5 deletions modules/imagens/Imagens.php → modules/images/Images.php
Expand Up @@ -12,9 +12,9 @@
* @since v0.1.5, 30/05/2009
*/

class Imagens extends Module
class Images extends Module
{
public $mainTable = 'imagens';
public $mainTable = 'images';

public $date = array(
'standardFormat' => '%d/%m/%Y',
Expand All @@ -23,11 +23,11 @@ class Imagens extends Module
);

public $fieldsToLoad = array(
'titulo', 'visitantes', 'systempath'
'title', 'pageviews', 'systempath'
);

public $authorField = "autor";
public $austField = "categoria";
public $authorField = "admin_id";
public $austField = "node_id";

public $defaultLimit = 25;

Expand Down
File renamed without changes.
@@ -1,84 +1,13 @@
<?php
/**
* Configurações
*
* Arquivo contendo informações sobre este módulo
*
* @package Modulos
* @name Config
* @author Alexandre de Oliveira <chavedomundo@gmail.com>
* @version 0.2
* @since v0.1.5, 30/05/2009
*/
/**
* Variável contendo as configurações deste módulo
*
* @global array $GLOBALS['modInfo']
* @name $modInfo
*/

$modInfo = array(
/**
* Cabeçalho
*
* Informações sobre o próprio módulo, como nome, descriçao, entre outros
*/
/**
* É arquitetura MVC
*/
'mvc' => true,
/**
* 'nome': Nome humano do módulo
*/
'name' => 'Imagens',
/**
* 'className': Classe oficial do módulo
*/
'className' => 'Imagens',
/**
* 'descricao': Descrição que facilita compreender a função do módulo
*/
'name' => 'Images',
'className' => 'Images',
'description' => 'Módulo gerenciador de imagens e banners',
/**
* 'estrutura': Se pode ser instalada como estrutura (Textos podem)
*/
'estrutura' => true,
/**
* 'somenteestrutura': É uma estrutura somente, sem categorias? (cadastros,
* por exemplo)
*/
'somenteestrutura' => true,
/**
* 'embed': É do tipo embed?
*/
'embed' => false,
/**
* 'embedownform': É do tipo embed que tem seu próprio formulário?
*/
'embedownform' => false,



/**
* RESPONSER
*/
/**
* Se possui método de leitura de resumo
*/
'responser' => array(
'actived' => false,
),

/**
* Opções de gerenciamento de conteúdo
*
* A opções a seguir dizem respeito a qualquer ação que envolva
* a interação do módulo com conteúdo.
*/
/**
* Opções de gerenciamento deste módulo
*
*/
'actions' => array(
'create' => 'Inserir',
'listing' => 'Listar',
Expand Down Expand Up @@ -173,37 +102,21 @@
'help' => 'Arquivos Flash têm a extensão swf.'
)
),

/*
* Se não há valor, substitui campo vazio na listagem
* pelos valores abaixo
*/
'replaceFieldsValueIfEmpty' => array(
'titulo' => '[Sem título]',
),

/**
* RESPONSER
*
* A seguir, as configurações do módulo para que este possa apresentar um
* resumo a qualquer requisitante (chamado responser).
*/
'arquitetura' => array(
'table' => 'textos',
'foreignKey' => 'categoria',
'title' => '[Sem título]',
),


/**
* '':
*/
'' => '',

/**
* CABEÇALHOS DE LISTAGEM
*/
'contentHeader' => array(
'campos' => array(
'adddate','titulo','node'
'created_on', 'title', 'node'
),
'camposNome' => array(
'Data','Título','Categoria'
Expand Down
@@ -0,0 +1,52 @@
<?php
/**
* MOD MIGRATION
*
* Migration de um módulos
*
*/
class Migration_20100120105600_CriarTabela extends Migrations
{
function up(){

$schema['images'] = array(
'id' => 'int NOT NULL auto_increment',
'node_id' => "int",
"title" => "text COMMENT 'O título do registro que será mostrado para humanos.'",
"title_encoded" => "text COMMENT 'Título tratado para ser mostrado na barra de endereços.'",
"subtitle" => "text",
"summary" => "text",
"description" => "text COMMENT 'Texto ou descrição.'",
"link" => "blob",
'order_nr' => 'int',
'image_bytes' => 'mediumint',
'image_binary_data' => 'longblob',
'image_name' => 'varchar(150)',
'image_type' => 'varchar(120)',
'reference' => 'varchar(50)',
'reference_id' => 'int',
'local' => "varchar(60) COMMENT 'Caso seja necessário especificar um local, seja para amostragem ou não.'",
'class' => 'varchar(60)',
'specie' => 'varchar(60)',
'expire_on' => 'date not null',
'created_on' => 'date not null',
'updated_on' => 'date not null',
'pageviews' => 'int',
'admin_id' => 'int',
'dbSchemaTableProperties' => array(
'PRIMARY KEY' => '(id)',
'UNIQUE' => 'id (id)',
)
);

$this->createTable( $schema );

return true;
}

function down(){
$this->dropTable('images');
return true;
}
}
?>
Expand Up @@ -10,27 +10,27 @@ class Migration_20100924144200_CreatePathFields extends Migrations
function up(){

$schema = array(
'table' => 'imagens',
'field' => 'path',
'table' => 'images',
'field' => 'image_path',
'type' => 'text',
'position' => 'AFTER ref_id'
'position' => 'AFTER image_type'
);
$this->addField($schema);

$schema = array(
'table' => 'imagens',
'field' => 'systempath',
'table' => 'images',
'field' => 'image_systempath',
'type' => 'text',
'position' => 'AFTER ref_id'
'position' => 'AFTER image_type'
);
$this->addField($schema);

return true;
}

function down(){
$this->dropField('imagens', 'path');
$this->dropField('imagens', 'systempath');
$this->dropField('images', 'image_path');
$this->dropField('images', 'image_systempath');
return true;
}
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 11774ab

Please sign in to comment.