if (!in_array('ansel_images', $tableList)) {
// Create: ansel_images
$t = $this->createTable('ansel_images', array('primaryKey' => false));
- $t->column('image_id', 'bigint', array('null' => false, 'autoincrement' => false));
- $t->column('gallery_id', 'bigint', array('null' => false));
+ $t->column('image_id', 'integer', array('null' => false));
+ $t->column('gallery_id', 'integer', array('null' => false));
$t->column('image_filename', 'string', array('limit' => 255, 'null' => false));
$t->column('image_type', 'string', array('limit' => 100, 'null' => false));
$t->column('image_caption', 'text');
- $t->column('image_uploaded_date', 'bigint', array('null' => false));
- $t->column('image_original_date', 'bigint', array('null' => false));
+ $t->column('image_uploaded_date', 'integer', array('null' => false));
+ $t->column('image_original_date', 'integer', array('null' => false));
$t->column('image_sort', 'integer', array('null' => false));
$t->column('image_faces', 'integer', array('null' => false, 'default' => 0));
$t->column('image_latitude', 'string', array('limit' => 32));
$t->column('image_longitude', 'string', array('limit' => 32));
$t->column('image_location', 'string', array('limit' => 255));
- $t->column('image_geotag_date', 'bigint');
+ $t->column('image_geotag_date', 'integer');
$t->primaryKey(array('image_id'));
$t->end();
// Create: ansel_image_attributes
//$t = $this->createTable('ansel_image_attributes', array('primaryKey' => 'image_id, attr_name'));
$t = $this->createTable('ansel_image_attributes', array('primaryKey' => false));
- $t->column('image_id', 'bigint', array('null' => false));
+ $t->column('image_id', 'integer', array('null' => false));
$t->column('attr_name', 'string', array('null' => false, 'limit' => 50));
$t->column('attr_value', 'string', array('limit' => 255));
$t->primaryKey(array('image_id', 'attr_name'));
if (!in_array('ansel_faces', $tableList)) {
// Create: ansel_faces
$t = $this->createTable('ansel_faces', array('primaryKey' => false));
- $t->column('face_id', 'bigint', array('null' => false, 'autoincrement' => false));
- $t->column('image_id', 'bigint', array('null' => false));
- $t->column('gallery_id', 'bigint', array('null' => false));
+ $t->column('face_id', 'integer', array('null' => false));
+ $t->column('image_id', 'integer', array('null' => false));
+ $t->column('gallery_id', 'integer', array('null' => false));
$t->column('face_name', 'string', array('limit' => 255));
$t->column('face_x1', 'integer', array('null' => false));
$t->column('face_y1', 'integer', array('null' => false));
if (!in_array('ansel_faces_index', $tableList)) {
// Create: ansel_faces_index
$t = $this->createTable('ansel_faces_index');
- $t->column('face_id', 'bigint', array('null' => false));
+ $t->column('face_id', 'integer', array('null' => false));
$t->column('index_position', 'integer', array('null' => false));
$t->column('index_part', 'binary');
$t->end();
if (!in_array('ansel_shares', $tableList)) {
// Create: ansel_shares
$t = $this->createTable('ansel_shares', array('primaryKey' => false));
- $t->column('share_id', 'bigint', array('null' => false));
+ $t->column('share_id', 'integer', array('null' => false));
$t->column('share_owner', 'string', array('limit' => 255, 'null' => false));
$t->column('share_parents', 'string', array('limit' => 255));
$t->column('perm_creator', 'integer', array('null' => false));
$t->column('attribute_default_prettythumb', 'text');
$t->column('attribute_style', 'string', array('limit' => 255));
$t->column('attribute_category', 'string', array('limit' => 255, 'null' => false, 'default' => ''));
- $t->column('attribute_last_modified', 'bigint');
- $t->column('attribute_date_created', 'bigint');
+ $t->column('attribute_last_modified', 'integer');
+ $t->column('attribute_date_created', 'integer');
$t->column('attribute_images', 'integer', array('null' => false, 'default' => 0));
$t->column('attribute_has_subgalleries', 'integer', array('null' => false, 'default' => 0));
$t->column('attribute_slug', 'string', array('limit' => 255));
if (!in_array('ansel_shares_groups', $tableList)) {
// Create: ansel_shares_groups
$t = $this->createTable('ansel_shares_groups');
- $t->column('share_id', 'bigint', array('null' => false));
- $t->column('group_uid', 'bigint', array('null' => false));
+ $t->column('share_id', 'integer', array('null' => false));
+ $t->column('group_uid', 'integer', array('null' => false));
$t->column('perm', 'integer', array('null' => false));
$t->end();
if (!in_array('ansel_shares_users', $tableList)) {
// Create: ansel_shares_users
$t = $this->createTable('ansel_shares_users');
- $t->column('share_id', 'bigint', array('null' => false));
- $t->column('user_uid', 'bigint', array('null' => false));
+ $t->column('share_id', 'integer', array('null' => false));
+ $t->column('user_uid', 'integer', array('null' => false));
$t->column('perm', 'integer', array('null' => false));
$t->end();
if (!in_array('ansel_images_geolocation', $tableList)) {
// Create: ansel_images_geolocation
$t = $this->createTable('ansel_images_geolocation', array('primaryKey' => false));
- $t->column('image_id', 'bigint', array('null' => false));
+ $t->column('image_id', 'integer', array('null' => false));
$t->column('image_latitude', 'string', array('limit' => 32));
$t->column('image_longitude', 'string', array('limit' => 32));
$t->column('image_location', 'string', array('limit' => 255));
{
public function up()
{
- $this->changeColumn('ansel_images', 'image_id', 'bigint', array('null' => false, 'autoincrement' => true));
- $this->changeColumn('ansel_faces', 'face_id', 'bigint', array('null' => false, 'autoincrement' => true));
- $this->changeColumn('ansel_shares', 'share_id', 'bigint', array('null' => false, 'autoincrement' => true));
+ $this->changeColumn('ansel_images', 'image_id', 'integer', array('null' => false, 'autoincrement' => true));
+ $this->changeColumn('ansel_faces', 'face_id', 'integer', array('null' => false, 'autoincrement' => true));
+ $this->changeColumn('ansel_shares', 'share_id', 'integer', array('null' => false, 'autoincrement' => true));
$this->changeColumn('ansel_tags', 'tag_id', 'integer', array('null' => false, 'autoincrement' => true));
}
{
$tableList = $this->tables();
- $this->changeColumn('ansel_images', 'image_id', 'bigint', array('null' => false, 'autoincrement' => false));
- $this->changeColumn('ansel_faces', 'face_id', 'bigint', array('null' => false, 'autoincrement' => false));
- $this->changeColumn('ansel_shares', 'share_id', 'bigint', array('null' => false, 'autoincrement' => false));
+ $this->changeColumn('ansel_images', 'image_id', 'integer', array('null' => false, 'autoincrement' => false));
+ $this->changeColumn('ansel_faces', 'face_id', 'integer', array('null' => false, 'autoincrement' => false));
+ $this->changeColumn('ansel_shares', 'share_id', 'integer', array('null' => false, 'autoincrement' => false));
if (in_array('ansel_tags', $tableList)) {
$this->changeColumn('ansel_tags', 'tag_id', 'integer', array('null' => false, 'autoincrement' => false));
--- /dev/null
+<?php
+/**
+ * Create Ansel base tables (as of Ansel 1.1.1).
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @category Horde
+ * @license http://www.fsf.org/copyleft/gpl.html GPL
+ * @package Ansel
+ */
+class AnselUpgradeUnsignedints extends Horde_Db_Migration_Base
+{
+ /**
+ * Upgrade.
+ */
+ public function up()
+ {
+ $this->changeColumn('ansel_images', 'image_id', 'integer', array('null' => false, 'autoincrement' => true, 'unsigned' => true));
+ $this->changeColumn('ansel_images', 'gallery_id', 'bigint', array('null' => false));
+ $this->changeColumn('ansel_images', 'image_uploaded_date', 'integer', array('null' => false, 'unsigned' => true));
+ $this->changeColumn('ansel_images', 'image_original_date', 'integer', array('null' => false, 'unsigned' => true));
+ $this->changeColumn('ansel_images', 'image_sort', 'integer', array('null' => false, 'unsigned' => true));
+ $this->changeColumn('ansel_images', 'image_faces', 'integer', array('null' => false, 'default' => 0, 'unsigned' => true));
+ $this->changeColumn('ansel_images', 'image_geotag_date', 'integer', array('unsigned' => true));
+
+ $this->changeColumn('ansel_image_attributes', 'image_id', 'integer', array('null' => false, 'unsigned' => true));
+
+ $this->changeColumn('ansel_faces', 'face_id', 'integer', array('null' => false, 'autoincrement' => true, 'unsigned' => true));
+ $this->changeColumn('ansel_faces', 'image_id', 'integer', array('null' => false, 'unsigned' => true));
+ $this->changeColumn('ansel_faces', 'gallery_id', 'bigint', array('null' => false));
+
+ $this->changeColumn('ansel_faces_index', 'face_id', 'integer', array('null' => false, 'unsigned' => true));
+ $this->changeColumn('ansel_faces_index', 'index_position', 'integer', array('null' => false, 'unsigned' => true));
+
+ $this->changeColumn('ansel_shares', 'share_id', 'bigint', array('null' => false, 'autoincrement' => true));
+ $this->changeColumn('ansel_shares', 'attribute_last_modified', 'integer', array('unsigned' => true));
+ $this->changeColumn('ansel_shares', 'attribute_date_created', 'integer', array('unsigned' => true));
+ $this->changeColumn('ansel_shares', 'attribute_images', 'integer', array('null' => false, 'default' => 0, 'unsigned' => true));
+ $this->changeColumn('ansel_shares', 'attribute_faces', 'integer', array('null' => false, 'default' => 0, 'unsigned' => true));
+
+ $this->changeColumn('ansel_shares_groups', 'group_uid', 'integer', array('null' => false, 'unsigned' => true));
+
+ $this->changeColumn('ansel_shares_users', 'user_uid', 'integer', array('null' => false, 'unsigned' => true));
+
+ $this->changeColumn('ansel_images_geolocation', 'image_id', 'integer', array('null' => false, 'unsigned' => true));
+ }
+
+ /**
+ * Downgrade
+ *
+ */
+ public function down()
+ {
+ // No need.
+ }
+
+}