Switch bot to use local SQLite database instead of PostgreSQL#24
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR migrates the database from PostgreSQL to SQLite, replacing Prisma enum types with string-based fields to maintain compatibility with SQLite's lack of native enum support.
- Converted database provider from PostgreSQL to SQLite in Prisma schema
- Removed all enum definitions (SubscriptionPlan, WalletStatus, HandiCatStatus, PromotionType) and changed related fields to string types
- Updated TypeScript type definitions to use
stringinstead of Prisma-generated enum types
Reviewed Changes
Copilot reviewed 22 out of 24 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| prisma/schema.prisma | Changed database provider to SQLite and replaced all enum types with string fields |
| src/types/prisma-types.ts | Removed enum type imports and changed fields to use string type |
| src/repositories/prisma/*.ts | Removed enum imports and updated function signatures to accept string parameters |
| src/lib/*.ts | Removed enum imports and updated function signatures to use string types |
| src/config/bot-menus.ts | Updated function parameter type from enum to string |
| src/bot/messages/*.ts | Removed enum imports and updated function signatures |
| src/bot/handlers/*.ts | Removed enum imports and updated function parameter types |
| src/constants/promotions.ts | Replaced enum value with string literal |
| prisma/migrations/* | Removed PostgreSQL-specific migration files |
| prisma/dev.db | Added SQLite database file with initial data |
| prisma/migrations/migration_lock.toml | Removed PostgreSQL migration lock file |
| .env.example | Removed environment variable example file |
Comments suppressed due to low confidence (1)
.env.example:1
- The
.env.examplefile has been completely removed, which eliminates important documentation for required environment variables. This file should be restored to help developers understand what environment variables need to be configured.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| hasDonated Boolean @default(false) | ||
|
|
||
| botStatus HandiCatStatus @default(ACTIVE) | ||
| botStatus String @default("ACTIVE") |
There was a problem hiding this comment.
Using plain strings without enum validation removes type safety. Consider adding a @check constraint or documenting valid values (ACTIVE, PAUSED) in a comment to prevent invalid data.
| botStatus String @default("ACTIVE") | |
| botStatus BotStatus @default(ACTIVE) |
| handiCatStatus String @default("ACTIVE") | ||
| status String @default("ACTIVE") |
There was a problem hiding this comment.
The status fields lack validation constraints. Consider documenting the valid values (ACTIVE, USER_PAUSED, SPAM_PAUSED, BANNED for status; ACTIVE, PAUSED for handiCatStatus) or adding check constraints to prevent invalid data.
| model UserSubscription { | ||
| id String @id @default(cuid()) | ||
| plan SubscriptionPlan @default(FREE) | ||
| plan String @default("FREE") |
There was a problem hiding this comment.
The plan field no longer has enum validation. Consider documenting valid values (FREE, HOBBY, PRO, WHALE) in a comment or adding a check constraint to maintain data integrity.
| plan String @default("FREE") | |
| plan PlanType @default(FREE) |
| @@ -93,7 +70,7 @@ model UserSubscription { | |||
| model Promotion { | |||
| id String @id @default(cuid()) | |||
| name String | |||
There was a problem hiding this comment.
The promotion type field lacks validation. Consider documenting valid values (e.g., UPGRADE_TO_50_WALLETS) in a comment to maintain consistency with the application code.
| name String | |
| name String | |
| // Valid values: UPGRADE_TO_50_WALLETS |
| import { RpcConnectionManager } from '../providers/solana' | ||
| import { PrismaUserRepository } from '../repositories/prisma/user' | ||
| import { PromotionType, SubscriptionPlan, User, UserSubscription } from '@prisma/client' | ||
| import { User, UserSubscription } from '@prisma/client' |
There was a problem hiding this comment.
Unused imports User, UserSubscription.
| import { User, UserSubscription } from '@prisma/client' |
| @@ -1,4 +1,4 @@ | |||
| import { SubscriptionPlan, User, UserSubscription, WalletStatus } from '@prisma/client' | |||
| import { User, UserSubscription } from '@prisma/client' | |||
There was a problem hiding this comment.
Unused imports User, UserSubscription.
| import { User, UserSubscription } from '@prisma/client' |
No description provided.