PHP Classes

File: SQL File

Recommend this page to a friend!
  Packages of Matthew Asham   Binkterm PHP   database/migrations/v1.5.2_restructure_address_book.sql   Download  
File: database/migrations/v1.5.2_restructure_address_book.sql
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Binkterm PHP
Bulletin board system based on the Web
Author: By
Last change:
Date: 1 month ago
Size: 1,494 bytes
 

Contents

Class file image Download
-- Restructure address book to separate descriptive name from messaging user ID -- This provides clearer separation between display name and actual messaging target -- Add the new user_id column for messaging ALTER TABLE address_book ADD COLUMN messaging_user_id VARCHAR(100); -- Rename full_name to name for descriptive purposes ALTER TABLE address_book RENAME COLUMN full_name TO name; -- Copy data from name to messaging_user_id initially (can be updated later) UPDATE address_book SET messaging_user_id = name; -- Make messaging_user_id NOT NULL after data copy ALTER TABLE address_book ALTER COLUMN messaging_user_id SET NOT NULL; -- Update indexes DROP INDEX IF EXISTS idx_address_book_full_name; CREATE INDEX IF NOT EXISTS idx_address_book_name ON address_book(user_id, name); CREATE INDEX IF NOT EXISTS idx_address_book_messaging_user_id ON address_book(user_id, messaging_user_id); -- Update the unique constraint to use messaging_user_id + node_address DROP INDEX IF EXISTS idx_address_book_unique_entry; CREATE UNIQUE INDEX IF NOT EXISTS idx_address_book_unique_entry ON address_book(user_id, messaging_user_id, node_address); -- Update column comments COMMENT ON COLUMN address_book.name IS 'Descriptive name for this contact (e.g., "John Smith", "Work colleague")'; COMMENT ON COLUMN address_book.messaging_user_id IS 'User ID/handle to use when sending messages to this contact'; COMMENT ON COLUMN address_book.node_address IS 'Fidonet node address (e.g., 1:234/567)';