ormed_mysql 0.1.0-dev+7 copy "ormed_mysql: ^0.1.0-dev+7" to clipboard
ormed_mysql: ^0.1.0-dev+7 copied to clipboard

MySQL / MariaDB adapter for the routed ORM driver interface.

example/main.dart

import 'package:ormed/ormed.dart';
import 'package:ormed_mysql/ormed_mysql.dart';

void main() async {
  // 1. Register the MySQL driver
  ensureMySqlDriverRegistration();

  // 2. Define configuration
  final config = OrmProjectConfig(
    activeConnectionName: 'default',
    connections: {
      'default': ConnectionDefinition(
        name: 'default',
        driver: DriverConfig(
          type: 'mysql',
          options: {
            'host': 'localhost',
            'port': 3306,
            'database': 'my_database',
            'username': 'root',
            'password': 'password',
          },
        ),
        migrations: MigrationSection(
          directory: 'database/migrations',
          registry: 'database/migrations.dart',
          ledgerTable: 'orm_migrations',
          schemaDump: 'database/schema',
        ),
      ),
    },
  );

  // 3. Create DataSource
  final ds = DataSource.fromConfig(config);

  // 4. Initialize (connects to DB)
  // await ds.init();

  print('MySQL DataSource created: ${ds.options.driver.metadata.name}');
}
0
likes
160
points
45
downloads

Publisher

unverified uploader

Weekly Downloads

MySQL / MariaDB adapter for the routed ORM driver interface.

Repository (GitHub)
View/report issues

Topics

#orm #database #mysql

Documentation

Documentation
API reference

Funding

Consider supporting this project:

www.buymeacoffee.com

License

MIT (license)

Dependencies

carbonized, decimal, meta, mysql_client_plus, ormed, uuid

More

Packages that depend on ormed_mysql