Skip to content

Switch bot to use local SQLite database instead of PostgreSQL#24

Open
Earajs wants to merge 1 commit into
DracoR22:mainfrom
Earajs:sqlite-migration
Open

Switch bot to use local SQLite database instead of PostgreSQL#24
Earajs wants to merge 1 commit into
DracoR22:mainfrom
Earajs:sqlite-migration

Conversation

@Earajs

@Earajs Earajs commented Nov 5, 2025

Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings November 5, 2025 10:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 string instead 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.example file 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.

Comment thread prisma/schema.prisma
hasDonated Boolean @default(false)

botStatus HandiCatStatus @default(ACTIVE)
botStatus String @default("ACTIVE")

Copilot AI Nov 5, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
botStatus String @default("ACTIVE")
botStatus BotStatus @default(ACTIVE)

Copilot uses AI. Check for mistakes.
Comment thread prisma/schema.prisma
Comment on lines +45 to +46
handiCatStatus String @default("ACTIVE")
status String @default("ACTIVE")

Copilot AI Nov 5, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread prisma/schema.prisma
model UserSubscription {
id String @id @default(cuid())
plan SubscriptionPlan @default(FREE)
plan String @default("FREE")

Copilot AI Nov 5, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
plan String @default("FREE")
plan PlanType @default(FREE)

Copilot uses AI. Check for mistakes.
Comment thread prisma/schema.prisma
@@ -93,7 +70,7 @@ model UserSubscription {
model Promotion {
id String @id @default(cuid())
name String

Copilot AI Nov 5, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
name String
name String
// Valid values: UPGRADE_TO_50_WALLETS

Copilot uses AI. Check for mistakes.
Comment thread src/lib/payments.ts
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'

Copilot AI Nov 5, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused imports User, UserSubscription.

Suggested change
import { User, UserSubscription } from '@prisma/client'

Copilot uses AI. Check for mistakes.
Comment thread src/types/prisma-types.ts
@@ -1,4 +1,4 @@
import { SubscriptionPlan, User, UserSubscription, WalletStatus } from '@prisma/client'
import { User, UserSubscription } from '@prisma/client'

Copilot AI Nov 5, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused imports User, UserSubscription.

Suggested change
import { User, UserSubscription } from '@prisma/client'

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants