vania-dart / framework

Fast, simple, and powerful backend framework for Dart built with ❤️
https://vdart.dev
MIT License
185 stars 15 forks source link

[BUG] - Migrations not working on postgres #95

Open Nashkim254 opened 3 months ago

Nashkim254 commented 3 months ago

I have a database connection properly set up but, when i run vania migrate command the table users is not created. Moreover when i run vania make:migration create_posts_table this command runs but the migraation is not created. When i repeat the same command i get a warning that it exists. The code below is the database client , apparently the postgresql case is not handled and the pgsql case doesent work either

import 'package:vania/vania.dart';

class DatabaseClient {
  DatabaseClient._internal();
  static final DatabaseClient _instance = DatabaseClient._internal();
  factory DatabaseClient() => _instance;

  DatabaseDriver? database;

  Future<void> setup() async {
    switch (env('DB_CONNECTION')) {
      case 'mysql':
        database = await MysqlDriver().init();
        database?.connection.reconnectIfMissingConnection();
        break;
      case 'postgresql':
      case 'pgsql':
        database = await PostgreSQLDriver().init();
        database?.connection.reconnectIfMissingConnection();
        break;
      default:
        break;
    }
  }
}
javad-zobeidi commented 3 months ago

1) check if you're using the last version of Vania cli or update with Vania update 2) delete this path lib\database 3) try to create new migration