@tomei/sso 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,18 @@
1
1
  ## SSO Package
2
2
 
3
3
  ### How to use
4
- - run npm i @tomei/sso@latest
5
- - Make sure you set the `DATABASE_URL` in your project `.env` file
6
- - run the `create-sso-user.sql` to create the neccessary database user and rights
4
+ - run `npm i`
5
+ - Make sure you set the `DATABASE_URL` and `SHADOW_DATABASE_URL` in your project `.env` file
6
+ - run `npm run start:dev`
7
+
8
+ ### How create a new migration
9
+ - Make sure you have `DATABASE_URL` and `SHADOW_DATABASE_URL` in your project `.env` file
10
+ - create a new empty database. dont do migration on it and set the `SHADOW_DATABASE_URL` to it
11
+ - Create a database user
12
+ - Grant the above user privileges to alter sso tables and shadow database. The user should have access to the sso table and shadow database only. Use `create-sso-user.sql` as an example to create the user and grant privileges
13
+ - Make changes to the `schema.prisma` file
14
+ - Run `npx prisma migrate dev --name <migration-name> --preview-feature --create-only` to create the migration. The migration will be created in the `migrations` folder. Review the migration and make changes if necessary.
15
+
16
+ ### How to run migration
17
+ - run `npx prisma migrate deploy` to run the migration
18
+
@@ -1,8 +1,8 @@
1
1
 
2
- -- Create sso-user
2
+ -- example to create sso-user
3
3
  CREATE USER 'sso_user'@'environment' IDENTIFIED BY 'password';
4
4
 
5
- -- Grant access to sso table
5
+ -- example to grant neccesary access to run migration
6
6
  GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_authorization_codes TO 'sso_user'@'localhost' WITH GRANT OPTION;
7
7
  GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_bearer_tokens TO 'sso_user'@'localhost' WITH GRANT OPTION;
8
8
  GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_building_types TO 'sso_user'@'localhost' WITH GRANT OPTION;
@@ -32,4 +32,8 @@ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on product
32
32
  GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_users TO 'sso_user'@'localhost' WITH GRANT OPTION;
33
33
  GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_usersystemprivilege TO 'sso_user'@'localhost' WITH GRANT OPTION;
34
34
  GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production.sso_usersystemrole TO 'sso_user'@'localhost' WITH GRANT OPTION;
35
- GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production._prisma_migrations TO 'sso_user'@'localhost' WITH GRANT OPTION;
35
+ GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES on production._prisma_migrations TO 'sso_user'@'localhost' WITH GRANT OPTION;
36
+
37
+
38
+ -- Grant user to create, alter, drop, references on the database (required for creating shadow tables)
39
+ GRANT CREATE, ALTER, DROP, REFERENCES ON shadow_database.* TO 'sso_user'@'localhost' WITH GRANT OPTION;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/sso",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Tomei SSO Package",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {