
Company News
Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development
Socket is scaling to defend open source against supply chain attacks as AI accelerates software development.
@pantherx.dev/casbin-rule-migration
Advanced tools
This library contains shared classes, interfaces and other non-platform specific functions. Even though the library is public, we do not provide support, or assurance for this to work now, or continue to work in the future.
So: This likely won't be useful to you unless you are working with us, or with / on one of our products.
This will do a couple of things:
Here's an example
$ node dist/src/casbin-migration
=> Get latest migration
Found migration from Fri Aug 20 2021 15:24:09 GMT+0000 (Coordinated Universal Time) with ID fa3f5530-3651-4429-9f97-c501e4ce0dc1
Comparison finished. Results:
# Remain: 81
# Update: 0
# Create: 2
# Delete: 0
Applied changes to the database. Results:
# Create: 2
# Delete: 0
FINAL LIST OF MANAGED ID's [
1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168,
1169, 1170, 1171, 1172, 1173, 1174, 1176, 1175, 1177,
1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186,
1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195,
1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204,
1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213,
1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222,
1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231,
1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240,
1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249,
1250, 1251, 1252, 1253, 1254, 1255
]
=> Saving new migration with 96 entries ...
With no migrations pending:
$ node dist/src/casbin-migration
=> Get latest migration
Found migration from Mon Sep 06 2021 04:01:34 GMT+0700 (Indochina Time) with ID 93ef9980-b4c2-4157-8b3c-dd5900967822
Comparison finished. Results:
# Remain: 95
# Update: 0
# Create: 0
# Delete: 0
No changes found. Nothing to do.
Install with
npm i --save @pantherx.dev/casbin-rule-migration
Create a casbin-migration.ts in src:
import { migrate } from 'packages/casbin-rule-migration/src'
import { allRouteRules, roleResourceAccessRules } from './permissions/identity-authorization-policies/rules'
migrate(allRouteRules, roleResourceAccessRules, false)
For this to work properly:
casbin_rule and casbin_rule_migrations table.From now on you can run this script, whenever there are any changes.
FAQs
Limited casbin rule migration after code changes
We found that @pantherx.dev/casbin-rule-migration demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket is scaling to defend open source against supply chain attacks as AI accelerates software development.

Research
/Security News
A long-running Go typosquat impersonated the popular shopspring/decimal library and used DNS TXT records to execute commands.

Research
Active npm supply chain attack compromises @antv packages in a fast-moving malicious publish wave tied to Mini Shai-Hulud.