medz / prisma-dart

Prisma Client Dart is an auto-generated type-safe ORM. It uses Prisma Engine as the data access layer and is as consistent as possible with the Prisma Client JS/TS APIs.
https://prisma.pub
BSD 3-Clause "New" or "Revised" License
452 stars 30 forks source link

Deployment and release #269

Closed jmakinin closed 8 months ago

jmakinin commented 1 year ago

I have been facing issues building a workable release version of my application running the Prisma client with SQLite database. The built release app cannot establish a connection to the SQLite database I am using.

My system is Windows 11

Flutter version

$ flutter --version Flutter 3.10.6 • channel stable • https://github.com/flutter/flutter.git Framework • revision f468f3366c (3 months ago) • 2023-07-12 15:19:05 -0700 Engine • revision cdbeda788a Tools • Dart 3.0.6 • DevTools 2.23.1

Dart version

$ dart --version Dart SDK version: 3.0.6 (stable) (Tue Jul 11 18:49:07 2023 +0000) on "windows_x64"

And I am targeting deployment to the Windows platform.

this is the database connection class

import 'dart:io'; import 'package:orm/logger.dart'; import 'generated/prisma_client.dart';

class PrismaConnect { static final databaseUrl = Platform.script.resolve('assets/database/source.sqlite').toFilePath(); late final PrismaClient prisma;

PrismaConnect() { _connect(); }

Future _connect() async { prisma = PrismaClient( stdout: Event.values, datasources: Datasources(db: 'file:$databaseUrl'), ); await prisma.$connect(); // Await the connection }

Future close() async { await prisma.$disconnect(); // Close the connection } }

this is the main application instance

import 'package:class_wise/core/utils/constants.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:window_size/window_size.dart'; //routes import 'package:class_wise/routes/router.dart';

void main() { WidgetsFlutterBinding.ensureInitialized(); setWindowTitle("CLassWise"); setWindowMinSize(const Size(1500, 900)); setWindowMaxSize(Size.infinite);

runApp(ProviderScope( child: MyApp(), )); }

class MyApp extends StatelessWidget { final GoRouter _router = createRouter(); @override Widget build(BuildContext context) { return MaterialApp.router( debugShowCheckedModeBanner: false, title: 'ClassWise', theme: ThemeData.dark().copyWith( scaffoldBackgroundColor: bgColor, textTheme: GoogleFonts.robotoFlexTextTheme(Theme.of(context).textTheme) .apply(bodyColor: Colors.white), canvasColor: secondaryColor, ), routerConfig: _router, ); } }

I'm pretty new to this, and I have so far not seen a Flutter desktop application in production (I don't know of any at the moment that uses the stack I am using) Any help will be much appreciated.

Windows #Deployment #Production #BuildRelease #DatabaseConnection #Flutter #Dart

medz commented 1 year ago

At present, Flutter (native) is not supported and can only be used for the data proxy engine. It will take me about two months to solve this problem.

jmakinin commented 1 year ago

okay, sure. I'm deadlocked in a project I'm currently working on, and the alternative is to change the entire stack if it can not be implemented as needed.

How can I help speed things up?

medz commented 1 year ago

okay, sure. I'm deadlocked in a project I'm currently working on, and the alternative is to change the entire stack if it can not be implemented as needed.

How can I help speed things up?

@jmakinin Can you help me speed up the implementation of this? There are many problems I have to deal with now. The first is debt, and the other is the adaptation of the new protocol of Prisma 5 (this will almost cause the entire project to be rewritten). I also need Prisma to dynamic library. It is really difficult to write. I am the only one maintaining the project from its inception to the present. I really have a lot of things that need to be done.

medz commented 11 months ago

I'm actively developing a new version to adapt to Prisma 5

medz commented 8 months ago

328