feat: add PostgreSQL database adapter support
This commit is contained in:
@@ -88,7 +88,14 @@ euchre_camp/
|
||||
|
||||
- Node.js 20+
|
||||
- npm or yarn
|
||||
- SQLite3
|
||||
- **SQLite3** (default) or **PostgreSQL** (optional)
|
||||
|
||||
**For SQLite (default):**
|
||||
- No additional setup required
|
||||
|
||||
**For PostgreSQL:**
|
||||
- PostgreSQL 12+ installed and running
|
||||
- Create a database for EuchreCamp
|
||||
|
||||
### Installation
|
||||
|
||||
@@ -103,13 +110,31 @@ euchre_camp/
|
||||
npm install
|
||||
```
|
||||
|
||||
3. **Set up the database**
|
||||
3. **Set up environment variables**
|
||||
```bash
|
||||
cp .env.example .env
|
||||
# Edit .env to configure your database
|
||||
```
|
||||
|
||||
4. **Set up the database**
|
||||
|
||||
**For SQLite (default):**
|
||||
```bash
|
||||
npx prisma migrate deploy
|
||||
npx prisma generate
|
||||
```
|
||||
|
||||
4. **Start the development server**
|
||||
**For PostgreSQL:**
|
||||
```bash
|
||||
# Set up PostgreSQL database
|
||||
npm run db:setup-postgres
|
||||
|
||||
# Or manually:
|
||||
npx prisma migrate deploy
|
||||
npx prisma generate
|
||||
```
|
||||
|
||||
5. **Start the development server**
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
@@ -119,11 +144,23 @@ euchre_camp/
|
||||
Create a `.env` file:
|
||||
|
||||
```env
|
||||
# Database Configuration
|
||||
DATABASE_PROVIDER=sqlite # or "postgresql"
|
||||
DATABASE_URL="file:./dev.db"
|
||||
|
||||
# Better Auth
|
||||
BETTER_AUTH_SECRET="your-secret-key-here"
|
||||
BETTER_AUTH_URL="http://localhost:3000"
|
||||
```
|
||||
|
||||
**Using PostgreSQL:**
|
||||
|
||||
```env
|
||||
DATABASE_PROVIDER=postgresql
|
||||
DATABASE_URL="postgresql://username:password@localhost:5432/euchre_camp"
|
||||
DATABASE_SHADOW_URL="postgresql://username:password@localhost:5432/euchre_camp_shadow"
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Creating a Tournament
|
||||
@@ -180,6 +217,20 @@ npm run test
|
||||
npm run test:acceptance
|
||||
```
|
||||
|
||||
### Database Commands
|
||||
|
||||
```bash
|
||||
# Switch between SQLite and PostgreSQL
|
||||
npm run db:switch sqlite
|
||||
npm run db:switch postgresql
|
||||
|
||||
# Set up PostgreSQL database
|
||||
npm run db:setup-postgres
|
||||
|
||||
# Seed database with sample data
|
||||
npm run db:seed
|
||||
```
|
||||
|
||||
## Admin User Creation
|
||||
|
||||
To create an admin user, use the provided scripts:
|
||||
|
||||
Reference in New Issue
Block a user