Files
opensourcepos/app/Database/Migrations/sqlscripts/3.5.0_PluginConfigTableCreate.sql
T
objecttothis 7f354a66ee refactor(plugins): rename plugin migrations table migration to config table
- Rename core migration 20260627000000_PluginMigrationsTableCreate to
  20261026000000_PluginConfigTableCreate, merging plugin_migrations
  table creation into the same SQL script as plugin_config and adding
  a startup log message; down() now drops both tables.
- Consolidate the plugin_migrations CREATE TABLE statement into
  3.5.0_PluginConfigTableCreate.sql and remove the now-redundant
  3.5.1_PluginMigrationsTableCreate.sql script.
- Update app/Plugins/README.md reference to the renamed migration
  class.
- Add WhatsAppPlugin migration CreateWhatsAppMessagesTable to create
  the whatsapp_messages conversation log table (utf8mb4, unique
  wa_message_id to dedupe webhook redelivery); dropped explicitly by
  WhatsAppPlugin::uninstall() instead of a down() method.

Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
2026-10-27 17:28:12 +04:00

29 lines
1.3 KiB
SQL

CREATE TABLE IF NOT EXISTS `ospos_plugin_config` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`plugin_id` varchar(100) NOT NULL,
`key` varchar(100) NOT NULL,
`value` text NOT NULL,
`is_control` tinyint(1) NOT NULL DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `uq_plugin_key` (`plugin_id`, `key`),
KEY `idx_plugin_id` (`plugin_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
CREATE TABLE IF NOT EXISTS `ospos_plugin_migrations` (
`plugin_id` varchar(100) NOT NULL,
`version` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
`ran_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`plugin_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
INSERT IGNORE INTO `ospos_modules` (`name_lang_key`, `desc_lang_key`, `sort`, `module_id`) VALUES
('module_plugins', 'module_plugins_desc', 111, 'plugins');
INSERT IGNORE INTO `ospos_permissions` (`permission_id`, `module_id`) VALUES
('plugins', 'plugins');
INSERT IGNORE INTO `ospos_grants` (`permission_id`, `person_id`, `menu_group`)
SELECT 'plugins', `person_id`, 'office' FROM `ospos_grants` WHERE `permission_id` = 'config';