Further changes to the table naming conventions to match expectations of CakePHP

git-svn-id: file:///svn-source/pmgr/branches/initial_20090526@11 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-05-27 20:32:31 +00:00
parent 2d9a85ad82
commit eeb8775820

View File

@@ -197,10 +197,10 @@ CREATE TABLE `pmgr_contact_emails` (
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- TABLE pmgr_contact_methods -- TABLE pmgr_contacts_methods
DROP TABLE IF EXISTS `pmgr_contact_methods`; DROP TABLE IF EXISTS `pmgr_contacts_methods`;
CREATE TABLE `pmgr_contact_methods` ( CREATE TABLE `pmgr_contacts_methods` (
`contact_id` INT(10) UNSIGNED NOT NULL, `contact_id` INT(10) UNSIGNED NOT NULL,
`method` ENUM('POST', `method` ENUM('POST',
'PHONE', 'PHONE',
@@ -400,7 +400,7 @@ CREATE TABLE `pmgr_site_options` (
-- SELECT U.id, P.name, MAX(P.access) -- SELECT U.id, P.name, MAX(P.access)
-- FROM pmgr_users U -- FROM pmgr_users U
-- LEFT JOIN pmgr_site_membership M ON M.user_id = U.id -- LEFT JOIN pmgr_site_membership M ON M.user_id = U.id
-- LEFT JOIN pmgr_groups G ON G.id = M.group_id -- LEFT JOIN pmgr_groups G ON G.id = M.group_id
-- LEFT JOIN pmgr_group_permissions P ON P.group_id = G.id -- LEFT JOIN pmgr_group_permissions P ON P.group_id = G.id
-- GROUP BY U.id, P.name -- GROUP BY U.id, P.name
@@ -581,10 +581,10 @@ CREATE TABLE `pmgr_late_schedules` (
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- TABLE pmgr_late_schedule_actions -- TABLE pmgr_actions_late_schedules
DROP TABLE IF EXISTS `pmgr_late_schedule_actions`; DROP TABLE IF EXISTS `pmgr_actions_late_schedules`;
CREATE TABLE `pmgr_late_schedule_actions` ( CREATE TABLE `pmgr_actions_late_schedules` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`late_schedule_id` INT(10) UNSIGNED DEFAULT NULL, `late_schedule_id` INT(10) UNSIGNED DEFAULT NULL,
@@ -673,10 +673,10 @@ CREATE TABLE `pmgr_leases` (
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- TABLE pmgr_lease_contacts -- TABLE pmgr_contacts_leases
DROP TABLE IF EXISTS `pmgr_lease_contacts`; DROP TABLE IF EXISTS `pmgr_contacts_leases`;
CREATE TABLE `pmgr_lease_contacts` ( CREATE TABLE `pmgr_contacts_leases` (
`lease_id` INT(10) UNSIGNED NOT NULL, `lease_id` INT(10) UNSIGNED NOT NULL,
`contact_id` INT(10) UNSIGNED NOT NULL, `contact_id` INT(10) UNSIGNED NOT NULL,
@@ -727,8 +727,8 @@ CREATE TABLE `pmgr_lease_contacts` (
-- Which charges haven not been paid? -- Which charges haven not been paid?
-- SELECT C.id AS cid, C.total AS total, COALESCE(SUM(R.amount),0) AS paid -- SELECT C.id AS cid, C.total AS total, COALESCE(SUM(R.amount),0) AS paid
-- FROM pmgr_transaction_charges C -- FROM pmgr_charges C
-- LEFT JOIN pmgr_transaction_reconciliations R ON R.charge_id = C.id -- LEFT JOIN pmgr_charges_receipts R ON R.charge_id = C.id
-- GROUP BY C.id -- GROUP BY C.id
-- HAVING paid < C.total -- HAVING paid < C.total
@@ -736,8 +736,8 @@ CREATE TABLE `pmgr_lease_contacts` (
-- SUM(ChL.total) AS total, SUM(ChL.paid) AS paid, -- SUM(ChL.total) AS total, SUM(ChL.paid) AS paid,
-- SUM(ChL.total) - SUM(ChL.paid) AS owing -- SUM(ChL.total) - SUM(ChL.paid) AS owing
-- FROM (SELECT Ch.lease_id AS lid, Ch.total AS total, COALESCE(SUM(R.amount),0) AS paid -- FROM (SELECT Ch.lease_id AS lid, Ch.total AS total, COALESCE(SUM(R.amount),0) AS paid
-- FROM pmgr_transaction_charges Ch -- FROM pmgr_charges Ch
-- LEFT JOIN pmgr_transaction_reconciliations R ON R.charge_id = Ch.id -- LEFT JOIN pmgr_charges_receipts R ON R.charge_id = Ch.id
-- WHERE Ch.due_date < NOW() -- WHERE Ch.due_date < NOW()
-- GROUP BY Ch.id -- GROUP BY Ch.id
-- HAVING paid < Ch.total) ChL -- HAVING paid < Ch.total) ChL
@@ -801,10 +801,10 @@ UNLOCK TABLES;
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- TABLE pmgr_transaction_charges -- TABLE pmgr_charges
DROP TABLE IF EXISTS `pmgr_transaction_charges`; DROP TABLE IF EXISTS `pmgr_charges`;
CREATE TABLE `pmgr_transaction_charges` ( CREATE TABLE `pmgr_charges` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`type_id` INT(10) UNSIGNED NOT NULL, `type_id` INT(10) UNSIGNED NOT NULL,
@@ -823,10 +823,10 @@ CREATE TABLE `pmgr_transaction_charges` (
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- TABLE pmgr_transaction_receipts -- TABLE pmgr_receipts
DROP TABLE IF EXISTS `pmgr_transaction_receipts`; DROP TABLE IF EXISTS `pmgr_receipts`;
CREATE TABLE `pmgr_transaction_receipts` ( CREATE TABLE `pmgr_receipts` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`stamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `stamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
@@ -839,10 +839,10 @@ CREATE TABLE `pmgr_transaction_receipts` (
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- TABLE pmgr_transaction_payments -- TABLE pmgr_payments
DROP TABLE IF EXISTS `pmgr_transaction_payments`; DROP TABLE IF EXISTS `pmgr_payments`;
CREATE TABLE `pmgr_transaction_payments` ( CREATE TABLE `pmgr_payments` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`receipt_id` INT(10) UNSIGNED NOT NULL, `receipt_id` INT(10) UNSIGNED NOT NULL,
@@ -857,10 +857,10 @@ CREATE TABLE `pmgr_transaction_payments` (
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- TABLE pmgr_transaction_reconciliations -- TABLE pmgr_charges_receipts
DROP TABLE IF EXISTS `pmgr_transaction_reconciliations`; DROP TABLE IF EXISTS `pmgr_charges_receipts`;
CREATE TABLE `pmgr_transaction_reconciliations` ( CREATE TABLE `pmgr_charges_receipts` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`charge_id` INT(10) UNSIGNED NOT NULL, `charge_id` INT(10) UNSIGNED NOT NULL,
-- REVISIT <AP>: 20090514 -- REVISIT <AP>: 20090514
@@ -908,11 +908,11 @@ CREATE TABLE `pmgr_maps` (
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- TABLE pmgr_map_units -- TABLE pmgr_maps_units
DROP TABLE IF EXISTS `pmgr_map_units`; DROP TABLE IF EXISTS `pmgr_maps_units`;
CREATE TABLE `pmgr_map_units` ( CREATE TABLE `pmgr_maps_units` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`map_id` INT(10) UNSIGNED NOT NULL, `map_id` INT(10) UNSIGNED NOT NULL,
`unit_id` INT(10) UNSIGNED NOT NULL, `unit_id` INT(10) UNSIGNED NOT NULL,