repository: https://github.com/TechWithTy/CyberoniSchema
package name : @techwithty/cyberoni-schema
installation: npm i @techwithty/cyberoni-schema
npm install prisma | Not npm install @prisma/client
Update Environment with Githhub personal Access token follow instructions here to generate token:
required permission: read:packages
add token to .env file
NPM_TOKEN=ghp_xxxxxxxxxxxxxxxxxxx
export NPM_TOKEN={token}
To add an environment variable like NPM_TOKEN to different terminals such as PowerShell, Bash, Zsh, and other shell environments, you'll need to follow specific instructions for each terminal. Here's how you can do it:
-
PowerShell (Windows):
# Set environment variable for current session $env:NPM_TOKEN = "your_token_here" # Alternatively, for permanent changes, add to profile: # Open profile (if not exists, create it) notepad $PROFILE # Add the following line to the profile: $env:NPM_TOKEN = "your_token_here"
-
Bash (Linux/Unix):
# Set environment variable for current session export NPM_TOKEN="your_token_here" # Alternatively, for permanent changes, add to profile: # Open profile (can be ~/.bashrc, ~/.bash_profile, or ~/.profile) nano ~/.bashrc # Add the following line to the profile: export NPM_TOKEN="your_token_here"```
-
Zsh (Z shell):
# Set environment variable for current session export NPM_TOKEN="your_token_here" # Alternatively, for permanent changes, add to profile: # Open profile (can be ~/.zshrc) nano ~/.zshrc # Add the following line to the profile: export NPM_TOKEN="your_token_here"
-
Other Shell Environments:
For other shell environments, the process is similar to Bash and Zsh. You typically need to add the export command to the appropriate shell profile file (e.g., ~/.bashrc, ~/.zshrc, ~/.profile).
use follwoing commad to install the latest schema version
npm install @techwithty/cyberoni-schema@latest
add schema loaction to package.json
// package.json
{
.
.
.
"prisma": {
"schema": "node_modules/@nehal7-ml/cybershoptechprismaschema/schema.prisma"
},
.
.
}
The User table stores information about users, including their first and last names, email, password, and role. Each user can have multiple related records in other tables like Account, Session, Blog, Review, Order, etc.
The Blog table stores information about blog posts, including their title, subtitle, description, content, and related images. Each blog post is linked to an author (user) and can have tags, likes, comments, and be part of a category or template.
The Service table stores information about different services offered, including their title, preview content, hourly rate, and related images. Each service can have tags, reviews, sub-services, descriptions, case studies, and FAQs.
The SoftwareProduct table stores information about software products, including their title, subtitle, description, images, tags, pricing model, and status. Each software product can have a category, blog, and subscription models.
The CaseStudy table stores detailed case studies related to services, including their title, type of service, preview, problem statement, user research, possible solutions, goals, and various other details.
The Discount table stores discount information, including the name, value, and expiration date. Discounts can be applied to service carts.
The Referral table stores information about referral campaigns, including the prefix, type, campaign ID, expiration date, description, priority, redirect link, fallback link, and the number of clicks.
crud functions are written for the crud-dashboard and datadriven in their respective repositories. This repo separately as they required different crud functions as per requirements
-
Ensure changes don't cause any rows to be reset or deleted. you can try the following if such situations arise (prisma will warn when this happens)
- provide default to values to newly added column
- ensure all constrains on a column can be met before pushing changes. you might need to write custom sql or a script to achieve this
-
Add Database url to env :
$env:DATABASE_URL_MAIN='mysql://<username>:<password>@<host>:<port>/<DBname>'
export DATABASE_URL_MAIN 'mysql://<username>:<password>@<host>:<port>/<DBname>'- try pushing the changes on a testing database, run
npm run push
-
Merge changes to main, ensure version number in updated package.json (published version cannot be updated and same version cannot be published twice)
-
Ensure schema changes have been pushed to Database
-
GitHub action is written to run when new release is published, create new release here : https://github.com/TechWithTy/CyberoniSchema/releases/new
-
Once release is created package should be published. Verify successful git actions here: https://github.com/TechWithTy/CyberoniSchema/actions
-
verify package is published by trying to install new version or check lates release here: https://github.com/TechWithTy/CyberoniSchema/pkgs/npm/cyberoni-schema
-
Replace "your_token_here" with your actual NPM token.
-
After adding the environment variable, you may need to restart the terminal or reload the profile for changes to take effect.
-
Ensure you keep sensitive information like tokens secure and do not share them in public repositories or insecure channels.
add NPM_TOKEN to the environment variables