@mashoor-tech/core-prisma
v1.1.5
Published
Shared Prisma schemas and clients for Mashoor microservices
Maintainers
Readme
@mashoor/core-prisma
Shared Prisma schemas and clients for Mashoor microservices architecture.
🚀 Installation
npm install @mashoor/core-prisma⚡ Quick Start
1. Set Environment Variables
You can use a .env file (recommended) or set variables in your shell:
DATABASE_URL="postgresql://username:password@localhost:5432/mashoor"2. Initialize Databases
mashoor-core-prisma init🛠️ Common CLI Commands
All commands are run directly with mashoor-core-prisma. Replace COMMAND with one of the options below:
| Command | Description | |-----------|------------------------------------| | check | Check environment and status | | init | Initialize database and migrations | | migrate | Run all migrations | | generate | Generate Prisma client | | studio | Open Prisma Studio | | reset | Reset database (dev only!) | | push | Push schema changes | | format | Format Prisma schema | | deploy | Deploy migrations (production) | | status | Check migration status | | help | Show help message |
Example:
mashoor-core-prisma migrate🌱 Usage Examples
Usage
import { PrismaClient } from '@mashoor-tech/core-prisma';
async function main() {
const client = new PrismaClient();
const users = await client.user.findMany();
console.log(users);
}
main();🧑💻 Development
Prerequisites
- Node.js 18+
- A PostgreSQL database
CLI Usage Only
All database and schema operations are performed using the CLI:
mashoor-core-prisma generate # Generate Prisma client
mashoor-core-prisma migrate # Run all migrations
mashoor-core-prisma deploy # Deploy migrations (production)
mashoor-core-prisma status # Check migration status
mashoor-core-prisma reset # Reset database (dev only!)
mashoor-core-prisma push # Push schema (no migration)
mashoor-core-prisma studio # Open Prisma Studio
mashoor-core-prisma format # Format Prisma schema
mashoor-core-prisma check # Check environment setup
mashoor-core-prisma init # Initialize database and migrations🏛️ Architecture
This package contains the main Prisma schema and generates a Prisma client accessible via generated/index.js. You can use this client for all your database operations.
📄 License
MIT
