--- Subscription tables

CREATE TABLE IF NOT EXISTS `suscripciones` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_de_usuario` int(11) NOT NULL,
  `stripe_customer_id` varchar(255) DEFAULT NULL,
  `stripe_subscription_id` varchar(255) DEFAULT NULL,
  `status` varchar(50) DEFAULT NULL,
  `current_period_end` datetime DEFAULT NULL,
  `cancel_at_period_end` tinyint(1) DEFAULT 0,
  `creado_el` timestamp NULL DEFAULT current_timestamp(),
  `actualizado_el` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniq_user` (`id_de_usuario`),
  KEY `idx_customer` (`stripe_customer_id`),
  KEY `idx_subscription` (`stripe_subscription_id`),
  KEY `idx_status` (`status`),
  CONSTRAINT `suscripciones_ibfk_1` FOREIGN KEY (`id_de_usuario`) REFERENCES `usuarios` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

