private function create_tables() { global $wpdb; $charset_collate = $wpdb->get_charset_collate(); // Check if we need to upgrade $installed_version = get_option( 'sp_db_version', '0' ); if ( version_compare( $installed_version, $this->db_version, '<' ) ) { $this->upgrade_database( $installed_version ); } require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); // Services table $table_name = $wpdb->prefix . 'sp_services'; $sql = "CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, name varchar(255) NOT NULL, description text, duration int(11) NOT NULL DEFAULT 60, price decimal(10,2) NOT NULL DEFAULT 0.00, category varchar(100), is_active tinyint(1) NOT NULL DEFAULT 1, created_at datetime DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY category (category), KEY is_active (is_active) ) $charset_collate;"; dbDelta( $sql ); // Staff table $table_name = $wpdb->prefix . 'sp_staff'; $sql = "CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, name varchar(255) NOT NULL, email varchar(255), phone varchar(20), specialties text, schedule text, is_active tinyint(1) NOT NULL DEFAULT 1, created_at datetime DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY email (email), KEY is_active (is_active) ) $charset_collate;"; dbDelta( $sql ); // Customers table $table_name = $wpdb->prefix . 'sp_customers'; $sql = "CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, name varchar(255) NOT NULL, email varchar(255), phone varchar(20), address text, notes text, last_visit date, created_at datetime DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), UNIQUE KEY email (email), KEY phone (phone), KEY last_visit (last_visit) ) $charset_collate;"; dbDelta( $sql ); // Appointments table $table_name = $wpdb->prefix . 'sp_appointments'; $sql = "CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, customer_id mediumint(9) NOT NULL, staff_id mediumint(9) NOT NULL, service_id mediumint(9) NOT NULL, appointment_date date NOT NULL, appointment_time time NOT NULL, status varchar(20) NOT NULL DEFAULT 'confirmed', notes text, created_at datetime DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY customer_id (customer_id), KEY staff_id (staff_id), KEY service_id (service_id), KEY appointment_date (appointment_date), KEY status (status), KEY appointment_datetime (appointment_date, appointment_time), CONSTRAINT fk_customer FOREIGN KEY (customer_id) REFERENCES {$wpdb->prefix}sp_customers(id) ON DELETE CASCADE, CONSTRAINT fk_staff FOREIGN KEY (staff_id) REFERENCES {$wpdb->prefix}sp_staff(id) ON DELETE CASCADE, CONSTRAINT fk_service FOREIGN KEY (service_id) REFERENCES {$wpdb->prefix}sp_services(id) ON DELETE CASCADE ) $charset_collate;"; dbDelta( $sql ); update_option( 'sp_db_version', $this->db_version ); } private function upgrade_database( $installed_version ) { global $wpdb; // Database upgrade routines for future versions // Version 1.1 upgrades (example for future use) if ( version_compare( $installed_version, '1.1', '<' ) ) { // Example: Add payment status column // $wpdb->query( "ALTER TABLE {$wpdb->prefix}sp_appointments ADD COLUMN payment_status varchar(20) DEFAULT 'pending'" ); } // Version 1.2 upgrades (example for future use) if ( version_compare( $installed_version, '1.2', '<' ) ) { // Example: Add reminder_sent column // $wpdb->query( "ALTER TABLE {$wpdb->prefix}sp_appointments ADD COLUMN reminder_sent tinyint(1) DEFAULT 0" ); } // Version 2.0 upgrades - major version changes if ( version_compare( $installed_version, '2.0', '<' ) ) { // Convert boolean fields to tinyint for better MySQL compatibility $wpdb->query( "ALTER TABLE {$wpdb->prefix}sp_services MODIFY COLUMN is_active tinyint(1) NOT NULL DEFAULT 1" ); $wpdb->query( "ALTER TABLE {$wpdb->prefix}sp_staff MODIFY COLUMN is_active tinyint(1) NOT NULL DEFAULT 1" ); // Add composite index for appointment datetime (MySQL compatible syntax) $wpdb->query( "ALTER TABLE {$wpdb->prefix}sp_appointments ADD KEY idx_appointment_datetime (appointment_date, appointment_time)" ); } // Always run this for any version upgrade $this->ensure_table_integrity(); } private function ensure_table_integrity() { global $wpdb; // Prevent infinite loops static $integrity_checked = false; if ( $integrity_checked ) { return; } $integrity_checked = true; // Check if all required tables exist and have correct structure $required_tables = array( $wpdb->prefix . 'sp_services', $wpdb->prefix . 'sp_staff', $wpdb->prefix . 'sp_customers', $wpdb->prefix . 'sp_appointments' ); $missing_tables = array(); foreach ( $required_tables as $table ) { if ( $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) !== $table ) { $missing_tables[] = $table; } } if ( ! empty( $missing_tables ) ) { // Tables missing, log and recreate error_log( "Salons Profit: Missing tables: " . implode( ', ', $missing_tables ) ); // Reset version to force recreation delete_option( 'sp_db_version' ); // Don't call create_tables() again to avoid infinite loop // Instead, let the next page load handle it } } Golden Rule - Church Singles Dating https://churchsinglesdating.com Easy Christian Dating with Tips and Reviews! Tue, 14 Nov 2023 20:16:28 +0000 en-GB hourly 1 https://wordpress.org/?v=6.8.5 Christian Dating Advice https://churchsinglesdating.com/christian-dating-advice/ Wed, 27 Sep 2023 14:43:49 +0000 https://churchsinglesdating.com/?p=196 Embarking on a Spiritual Romance: The Golden Rule and Beyond in Christian Dating Seeking christian dating advice often leads believers to divine guidance, ensuring relationships blossom in a garden of faith and mutual respect. The Golden Rule, “Do unto others as you would have them do unto you,” serves as a pivotal principle, steering connections … Continue reading "Christian Dating Advice"

The post Christian Dating Advice first appeared on Church Singles Dating.

]]>
Embarking on a Spiritual Romance: The Golden Rule and Beyond in Christian Dating

Seeking christian dating advice often leads believers to divine guidance, ensuring relationships blossom in a garden of faith and mutual respect. The Golden Rule, “Do unto others as you would have them do unto you,” serves as a pivotal principle, steering connections towards spiritual growth and emotional enrichment. Thus, this article aims to explore faith, the Golden Rule, and the first and greatest commandment in Christian dating, crafting a pathway that aligns with God’s teachings.

Christian Dating Advice: Importance of Faith

Anchoring Relationships in Spiritual Truth

Faith actively shapes actions, decisions, and interactions in Christian dating, ensuring relationships honor God and uphold His principles.

Navigating Challenges with Faith

Every relationship encounters storms and challenges. Faith provides the strength and wisdom to navigate these difficulties, ensuring alignment with biblical truths.

Applying the Golden Rule: A Key Christian Dating Advice

Fostering Mutual Respect and Understanding

The Golden Rule ensures respect and consideration permeate interactions and relationships, encouraging honoring feelings, boundaries, and values with empathy and love.

Honest Communication in Christian Dating

Honesty and transparency are vital in healthy, trusting relationships. Thus, the Golden Rule encourages open communication in a safe and supportive environment.

The First and Greatest Commandment in Christian Dating Advice

Loving God Above All

The first and greatest commandment, “Love the Lord your God with all your heart and with all your soul and with all your mind” (Matthew 22:37), serves as the cornerstone in Christian dating, ensuring God remains the focal point of the relationship.

Loving Your Neighbor as Yourself

The subsequent commandment, “Love your neighbor as yourself” (Matthew 22:39), complements the first, fostering selfless love, patience, and kindness.

Conclusion: Christian Dating Advice for a Spiritually Rooted Love Journey

Navigating romantic relationships, especially in Christian dating, intertwines earthly emotions with heavenly principles. The journey becomes enriching and spiritually uplifting when guided by the divine wisdom of the Golden Rule and the greatest commandments.

A Call to Action: Embrace Love with Spiritual Vigilance

Dear readers, as you step forward in your journey of Christian dating, may you carry these principles as a lantern that lights your path. Let the Golden Rule and the greatest commandments be the lenses through which you view and navigate through every stage of your relationship.

References

  1. The Bible, New International Version (NIV)
    • Matthew 7:12
    • Matthew 22:37
    • Matthew 22:39

Further Reading

  • Chapman, G. (2015). The 5 Love Languages.
  • Cloud, H., & Townsend, J. (2000). Boundaries in Dating.
  • Eggerichs, E. (2004). Love & Respect.

Online Resources

The post Christian Dating Advice first appeared on Church Singles Dating.

]]>