Skip to content

Instantly share code, notes, and snippets.

@chicks
chicks / repair.php
Last active September 3, 2019 08:08
Quick Repair and Rebuild Sugar from the Command line - adapted from Jeff Bickhart's version.
#! /usr/bin/env php
<?php
# Stuff we have to do
if(!defined('sugarEntry'))define('sugarEntry', true);
function usage() {
global $argv;
return "\n" . $argv[0] . " <path to sugar>\n";
}
@steegi
steegi / gist:2942084
Created June 16, 2012 17:53
Script to drop disconnect and drop DB2 database
#!/bin/sh
db2 "connect to sugarult"
# Not sure if the following is actually need if the database needs to be restarted
# because of the 'currently in use' issues. However it should disconnect all application
# connected to the database.
db2 "quiesce database immediate force connections"
db2 "unquiesce database"
@steegi
steegi / gist:2934101
Created June 15, 2012 01:27
Script to drop all tables in a DB2 database
#/bin/sh
# Since there is no simple drop all tables from a database command in DB2,
# this script uses a few unix utilities to accomplish the same result
# Note that it assumes that your session is already connected to the database
# and that the schema from which you want to drop the tables has the same name
# as your current user.
db2 "Select 'DROP TABLE', TABLE_NAME from sysibm.tables WHERE TABLE_SCHEMA = UPPER('$USER')" | grep DROP | db2
@steegi
steegi / gist:2934001
Created June 15, 2012 01:07
Creating a SugarCRM DB2 developer database that works for all circumstances, but isn't suited for production
#!/bin/sh
# NOTE this creates a default 32k table space which is the maximum. Only a few tables in Sugar need 8k, others need only 4k
# However if you are using Studio the table needs enough extra space to add columns
# Also note that the specified collation is case insensitive US. By default DB2 is case sensitive.
db2 "CREATE DATABASE sugarult USING CODESET UTF-8 TERRITORY US COLLATE USING UCA500R1_LEN_S2 PAGESIZE 32 K"
# Sugar 6.4 and 6.5 need the Full Text Search engine up and running and operational.