Dart - sql()

Creates a reference to a SQL database.

import 'package:nitric_sdk/nitric.dart';

final db = Nitric.sql("my-database");

Parameters

  • Name
    name
    Required
    Required
    Type
    string
    Description

    The unique name of this database within the project.

  • Name
    migrations
    Optional
    Optional
    Type
    string
    Description

    Points to the location of migration files, prefixed with file://, or a migration dockerfile, prefixed with dockerfile://.

Examples

Create a reference to a database

import 'package:nitric_sdk/nitric.dart';

final db = Nitric.sql("my-database");

With a migrations directory

import 'package:nitric_sdk/nitric.dart';

final db = Nitric.sql("my-database", migrations: "file://migrations/my-database");

With a migrations dockerfile

import 'package:nitric_sdk/nitric.dart';

final db = Nitric.sql("my-database", migrations: "dockerfile://migrations.dockerfile");

See also