INSERT INTO "permission" ("id", "name", "description")
VALUES
	('users.create', 'users.create', 'Allows users create'),
	('users.delete', 'users.delete', 'Allows users delete')
ON CONFLICT ("id") DO UPDATE SET
	"name" = EXCLUDED."name",
	"description" = EXCLUDED."description",
	"updated_at" = now();
--> statement-breakpoint
INSERT INTO "role_permission" ("role_id", "permission_id")
SELECT 'role_admin', "permission"."id"
FROM "permission"
WHERE "permission"."id" IN ('users.create', 'users.delete')
	AND EXISTS (SELECT 1 FROM "role" WHERE "role"."id" = 'role_admin')
ON CONFLICT DO NOTHING;
