-- =========================================================
-- 038_machine_asset_permissions.sql
-- Seed permission Asset Mesin + Maintenance
-- =========================================================

INSERT IGNORE INTO permissions (code, name, module, created_at) VALUES
('machine_assets.view','Lihat Asset Mesin','machine_assets',NOW()),
('machine_assets.manage','Kelola Asset Mesin','machine_assets',NOW());

INSERT IGNORE INTO role_permissions (role_id, permission_id)
SELECT r.id, p.id
FROM roles r
JOIN permissions p ON p.code IN (
  'machine_assets.view',
  'machine_assets.manage'
)
WHERE r.code IN ('owner','admin','kepala_toko');
